From a0b67f4059ffab31581f086c882427d032ad7bb7 Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Thu, 28 Jun 2018 13:39:49 +0200 Subject: [PATCH 001/136] Add Shake Transformation --- .../Rulesets/Objects/Drawables/DrawableHitObject.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 88990d435c..4bae3e93e6 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -13,6 +13,8 @@ using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; using OpenTK.Graphics; +using osu.Framework.Graphics; +using OpenTK; namespace osu.Game.Rulesets.Objects.Drawables { @@ -229,6 +231,16 @@ namespace osu.Game.Rulesets.Objects.Drawables protected virtual void CheckForJudgements(bool userTriggered, double timeOffset) { } + + public void Shake() + { + this.MoveToOffset(new Vector2(8, 0), 20).Delay(20) + .MoveToOffset(-new Vector2(16, 0), 20).Delay(20) + .MoveToOffset(new Vector2(16, 0), 20).Delay(20) + .MoveToOffset(-new Vector2(16, 0), 20).Delay(20) + .MoveToOffset(new Vector2(16, 0), 20).Delay(20) + .MoveToOffset(-new Vector2(8, 0), 20); + } } public abstract class DrawableHitObject : DrawableHitObject From 61c416dc16d0a35ac5740993902f03cf0ab64fb6 Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Thu, 28 Jun 2018 13:41:23 +0200 Subject: [PATCH 002/136] Trigger Shake if HitCircles are hit too early --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 9fe6dcd46c..a133e85842 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -88,7 +88,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables var result = HitObject.HitWindows.ResultFor(timeOffset); if (result == HitResult.None) + { + Shake(); return; + } AddJudgement(new OsuJudgement { From 59e03fa5289512e795960fe0f6c13c98a36a9b98 Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Thu, 28 Jun 2018 15:33:59 +0200 Subject: [PATCH 003/136] Move Shake to DrawableOsuHitObject, Clean up Shake() --- .../Objects/Drawables/DrawableOsuHitObject.cs | 12 ++++++++++++ .../Rulesets/Objects/Drawables/DrawableHitObject.cs | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 7c9503dfe2..c871520080 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -58,6 +58,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private OsuInputManager osuActionInputManager; internal OsuInputManager OsuActionInputManager => osuActionInputManager ?? (osuActionInputManager = GetContainingInputManager() as OsuInputManager); + + public void Shake() + { + const int shake_amount = 8; + + this.MoveToX(Position.X + shake_amount, 20).Then() + .MoveToX(Position.X - shake_amount, 20).Then() + .MoveToX(Position.X + shake_amount, 20).Then() + .MoveToX(Position.X - shake_amount, 20).Then() + .MoveToX(Position.X + shake_amount, 20).Then() + .MoveToX(Position.X, 20); + } } public enum ComboResult diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 4bae3e93e6..88990d435c 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -13,8 +13,6 @@ using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; using OpenTK.Graphics; -using osu.Framework.Graphics; -using OpenTK; namespace osu.Game.Rulesets.Objects.Drawables { @@ -231,16 +229,6 @@ namespace osu.Game.Rulesets.Objects.Drawables protected virtual void CheckForJudgements(bool userTriggered, double timeOffset) { } - - public void Shake() - { - this.MoveToOffset(new Vector2(8, 0), 20).Delay(20) - .MoveToOffset(-new Vector2(16, 0), 20).Delay(20) - .MoveToOffset(new Vector2(16, 0), 20).Delay(20) - .MoveToOffset(-new Vector2(16, 0), 20).Delay(20) - .MoveToOffset(new Vector2(16, 0), 20).Delay(20) - .MoveToOffset(-new Vector2(8, 0), 20); - } } public abstract class DrawableHitObject : DrawableHitObject From e3317b5145f4aa7c4a31fd649849691c649fa60f Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Fri, 29 Jun 2018 17:31:13 +0900 Subject: [PATCH 004/136] Make method protected --- 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 c871520080..c02d711ee8 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private OsuInputManager osuActionInputManager; internal OsuInputManager OsuActionInputManager => osuActionInputManager ?? (osuActionInputManager = GetContainingInputManager() as OsuInputManager); - public void Shake() + protected void Shake() { const int shake_amount = 8; From 3d500500899c27f2dc634cb12363ff5ebdd2e2b4 Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Fri, 29 Jun 2018 10:36:00 +0200 Subject: [PATCH 005/136] Move shake duration to a constant --- .../Objects/Drawables/DrawableOsuHitObject.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index c02d711ee8..f25ddc4d82 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -62,13 +62,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected void Shake() { const int shake_amount = 8; + const int shake_duration = 20; - this.MoveToX(Position.X + shake_amount, 20).Then() - .MoveToX(Position.X - shake_amount, 20).Then() - .MoveToX(Position.X + shake_amount, 20).Then() - .MoveToX(Position.X - shake_amount, 20).Then() - .MoveToX(Position.X + shake_amount, 20).Then() - .MoveToX(Position.X, 20); + this.MoveToX(Position.X + shake_amount, shake_duration).Then() + .MoveToX(Position.X - shake_amount, shake_duration).Then() + .MoveToX(Position.X + shake_amount, shake_duration).Then() + .MoveToX(Position.X - shake_amount, shake_duration).Then() + .MoveToX(Position.X + shake_amount, shake_duration).Then() + .MoveToX(Position.X, shake_duration); } } From 558b2622a74e90ef7899b4d1d8549dba62e53ae3 Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Thu, 5 Jul 2018 15:48:54 +0200 Subject: [PATCH 006/136] Move the Shake logic to a new ShakeContainer --- .../Objects/Drawables/DrawableOsuHitObject.cs | 23 +++++++++++------- .../Objects/Drawables/DrawableSlider.cs | 2 +- .../Objects/Drawables/Pieces/SliderBall.cs | 6 +++-- .../Graphics/Containers/ShakeContainer.cs | 24 +++++++++++++++++++ 4 files changed, 43 insertions(+), 12 deletions(-) create mode 100644 osu.Game/Graphics/Containers/ShakeContainer.cs diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index f25ddc4d82..6b12fc029e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -8,6 +8,7 @@ using System.Linq; using osu.Game.Rulesets.Objects.Types; using osu.Game.Skinning; using OpenTK.Graphics; +using osu.Game.Graphics.Containers; namespace osu.Game.Rulesets.Osu.Objects.Drawables { @@ -15,12 +16,24 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { public override bool IsPresent => base.IsPresent || State.Value == ArmedState.Idle && Time.Current >= HitObject.StartTime - HitObject.TimePreempt; + private readonly ShakeContainer shakeContainer; + protected DrawableOsuHitObject(OsuHitObject hitObject) : base(hitObject) { + shakeContainer = new ShakeContainer + { + RelativeSizeAxes = Axes.Both, + }; + base.AddInternal(shakeContainer); Alpha = 0; } + // Forward all internal management to shakeContainer + protected override void AddInternal(Drawable drawable) => shakeContainer.Add(drawable); + protected override void ClearInternal(bool disposeChildren = true) => shakeContainer.Clear(disposeChildren); + protected override bool RemoveInternal(Drawable drawable) => shakeContainer.Remove(drawable); + protected sealed override void UpdateState(ArmedState state) { double transformTime = HitObject.StartTime - HitObject.TimePreempt; @@ -61,15 +74,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected void Shake() { - const int shake_amount = 8; - const int shake_duration = 20; - - this.MoveToX(Position.X + shake_amount, shake_duration).Then() - .MoveToX(Position.X - shake_amount, shake_duration).Then() - .MoveToX(Position.X + shake_amount, shake_duration).Then() - .MoveToX(Position.X - shake_amount, shake_duration).Then() - .MoveToX(Position.X + shake_amount, shake_duration).Then() - .MoveToX(Position.X, shake_duration); + shakeContainer.Shake(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index c8544d9cc1..d48419ba53 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables }, ticks = new Container { RelativeSizeAxes = Axes.Both }, repeatPoints = new Container { RelativeSizeAxes = Axes.Both }, - Ball = new SliderBall(s) + Ball = new SliderBall(s, this) { BypassAutoSizeAxes = Axes.Both, Scale = new Vector2(s.Scale), diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 894d972e47..278bb0dcb1 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -34,9 +34,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private readonly Slider slider; public readonly Box FollowCircle; private readonly Box ball; + private readonly DrawableSlider drawableSlider; - public SliderBall(Slider slider) + public SliderBall(Slider slider, DrawableSlider drawableSlider = null) { + this.drawableSlider = drawableSlider; this.slider = slider; Masking = true; AutoSizeAxes = Axes.Both; @@ -136,7 +138,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces Tracking = canCurrentlyTrack && lastState != null && base.ReceiveMouseInputAt(lastState.Mouse.NativeState.Position) - && ((Parent as DrawableSlider)?.OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false); + && (drawableSlider?.OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false); } } diff --git a/osu.Game/Graphics/Containers/ShakeContainer.cs b/osu.Game/Graphics/Containers/ShakeContainer.cs new file mode 100644 index 0000000000..33fba390d6 --- /dev/null +++ b/osu.Game/Graphics/Containers/ShakeContainer.cs @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2018 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; + +namespace osu.Game.Graphics.Containers +{ + public class ShakeContainer : Container + { + public void Shake() + { + const int shake_amount = 8; + const int shake_duration = 20; + + this.MoveToX(shake_amount, shake_duration).Then() + .MoveToX(-shake_amount, shake_duration).Then() + .MoveToX(shake_amount, shake_duration).Then() + .MoveToX(-shake_amount, shake_duration).Then() + .MoveToX(shake_amount, shake_duration).Then() + .MoveToX(0, shake_duration); + } + } +} From d4534140706cb277e317a7340453caa1dfe3b4b1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 Jul 2018 11:52:58 +0900 Subject: [PATCH 007/136] Forward shakes from slider head objects to sliders --- .../Objects/Drawables/DrawableOsuHitObject.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 5 ++++- .../Objects/Drawables/DrawableSliderHead.cs | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 6b12fc029e..bf58c0c0e3 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private OsuInputManager osuActionInputManager; internal OsuInputManager OsuActionInputManager => osuActionInputManager ?? (osuActionInputManager = GetContainingInputManager() as OsuInputManager); - protected void Shake() + protected virtual void Shake() { shakeContainer.Shake(); } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index d48419ba53..2b1c37b2b6 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -52,7 +52,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables AlwaysPresent = true, Alpha = 0 }, - HeadCircle = new DrawableSliderHead(s, s.HeadCircle), + HeadCircle = new DrawableSliderHead(s, s.HeadCircle) + { + OnShake = Shake + }, TailCircle = new DrawableSliderTail(s, s.TailCircle) }; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs index e823c870f9..fbea927956 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Game.Rulesets.Objects.Types; using OpenTK; @@ -28,5 +29,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables if (!IsHit) Position = slider.CurvePositionAt(completionProgress); } + + public Action OnShake; + + protected override void Shake() => OnShake?.Invoke(); } } From 0ecbc5945f3a93914756d42baf459bc2a9cd14c9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 Jul 2018 12:07:39 +0900 Subject: [PATCH 008/136] Adjust transform to look better --- osu.Game/Graphics/Containers/ShakeContainer.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Graphics/Containers/ShakeContainer.cs b/osu.Game/Graphics/Containers/ShakeContainer.cs index 33fba390d6..3316fb5306 100644 --- a/osu.Game/Graphics/Containers/ShakeContainer.cs +++ b/osu.Game/Graphics/Containers/ShakeContainer.cs @@ -10,15 +10,15 @@ namespace osu.Game.Graphics.Containers { public void Shake() { - const int shake_amount = 8; - const int shake_duration = 20; + const float shake_amount = 8; + const float shake_duration = 30; - this.MoveToX(shake_amount, shake_duration).Then() - .MoveToX(-shake_amount, shake_duration).Then() - .MoveToX(shake_amount, shake_duration).Then() - .MoveToX(-shake_amount, shake_duration).Then() - .MoveToX(shake_amount, shake_duration).Then() - .MoveToX(0, shake_duration); + this.MoveToX(shake_amount, shake_duration / 2, Easing.OutSine).Then() + .MoveToX(-shake_amount, shake_duration, Easing.InOutSine).Then() + .MoveToX(shake_amount, shake_duration, Easing.InOutSine).Then() + .MoveToX(-shake_amount, shake_duration, Easing.InOutSine).Then() + .MoveToX(shake_amount, shake_duration, Easing.InOutSine).Then() + .MoveToX(0, shake_duration / 2, Easing.InSine); } } } From 48d90a67ae60446b29bfae1a461d7c1219b15a94 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 Jul 2018 12:13:23 +0900 Subject: [PATCH 009/136] xmldoc and formatting --- .../Objects/Drawables/DrawableOsuHitObject.cs | 11 ++--------- osu.Game/Graphics/Containers/ShakeContainer.cs | 6 ++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index bf58c0c0e3..1764d3c487 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -21,11 +21,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected DrawableOsuHitObject(OsuHitObject hitObject) : base(hitObject) { - shakeContainer = new ShakeContainer - { - RelativeSizeAxes = Axes.Both, - }; - base.AddInternal(shakeContainer); + base.AddInternal(shakeContainer = new ShakeContainer { RelativeSizeAxes = Axes.Both }); Alpha = 0; } @@ -72,10 +68,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private OsuInputManager osuActionInputManager; internal OsuInputManager OsuActionInputManager => osuActionInputManager ?? (osuActionInputManager = GetContainingInputManager() as OsuInputManager); - protected virtual void Shake() - { - shakeContainer.Shake(); - } + protected virtual void Shake() => shakeContainer.Shake(); } public enum ComboResult diff --git a/osu.Game/Graphics/Containers/ShakeContainer.cs b/osu.Game/Graphics/Containers/ShakeContainer.cs index 3316fb5306..f90ae5c438 100644 --- a/osu.Game/Graphics/Containers/ShakeContainer.cs +++ b/osu.Game/Graphics/Containers/ShakeContainer.cs @@ -6,8 +6,14 @@ using osu.Framework.Graphics.Containers; namespace osu.Game.Graphics.Containers { + /// + /// A container that adds the ability to shake its contents. + /// public class ShakeContainer : Container { + /// + /// Shake the contents of this container. + /// public void Shake() { const float shake_amount = 8; From e0413526906881d5b15162eea09145b56f09f999 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 Jul 2018 13:02:00 +0900 Subject: [PATCH 010/136] Add comment regarding add/clear/remove overrides --- .../Objects/Drawables/DrawableOsuHitObject.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 1764d3c487..cc4a6ea547 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -25,7 +25,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Alpha = 0; } - // Forward all internal management to shakeContainer + // Forward all internal management to shakeContainer. + // This is a bit ugly but we don't have the concept of InternalContent so it'll have to do for now. (https://github.com/ppy/osu-framework/issues/1690) protected override void AddInternal(Drawable drawable) => shakeContainer.Add(drawable); protected override void ClearInternal(bool disposeChildren = true) => shakeContainer.Clear(disposeChildren); protected override bool RemoveInternal(Drawable drawable) => shakeContainer.Remove(drawable); From 98410dbb6d3276d674bba5e5f77bdffd1e598b40 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 Jul 2018 13:23:44 +0900 Subject: [PATCH 011/136] Reduce shake transform count by one for more aesthetic behaviour --- osu.Game/Graphics/Containers/ShakeContainer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/ShakeContainer.cs b/osu.Game/Graphics/Containers/ShakeContainer.cs index f90ae5c438..57544e8892 100644 --- a/osu.Game/Graphics/Containers/ShakeContainer.cs +++ b/osu.Game/Graphics/Containers/ShakeContainer.cs @@ -23,7 +23,6 @@ namespace osu.Game.Graphics.Containers .MoveToX(-shake_amount, shake_duration, Easing.InOutSine).Then() .MoveToX(shake_amount, shake_duration, Easing.InOutSine).Then() .MoveToX(-shake_amount, shake_duration, Easing.InOutSine).Then() - .MoveToX(shake_amount, shake_duration, Easing.InOutSine).Then() .MoveToX(0, shake_duration / 2, Easing.InSine); } } From 79af5cb0a03ad08af91e2b65ac14e847ad63d292 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 Jul 2018 17:24:30 +0900 Subject: [PATCH 012/136] Limit shake duration to ensure it doesn't overlap miss window --- .../Objects/Drawables/DrawableHitCircle.cs | 2 +- .../Objects/Drawables/DrawableOsuHitObject.cs | 2 +- .../Objects/Drawables/DrawableSliderHead.cs | 4 ++-- .../Graphics/Containers/ShakeContainer.cs | 22 ++++++++++++++----- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 79705356fa..212bc01ef9 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -89,7 +89,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables var result = HitObject.HitWindows.ResultFor(timeOffset); if (result == HitResult.None) { - Shake(); + Shake(Math.Abs(timeOffset) - HitObject.HitWindows.HalfWindowFor(HitResult.Miss)); return; } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index cc4a6ea547..89b81a02ac 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private OsuInputManager osuActionInputManager; internal OsuInputManager OsuActionInputManager => osuActionInputManager ?? (osuActionInputManager = GetContainingInputManager() as OsuInputManager); - protected virtual void Shake() => shakeContainer.Shake(); + protected virtual void Shake(double maximumLength) => shakeContainer.Shake(maximumLength); } public enum ComboResult diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs index fbea927956..6d6cba4936 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs @@ -30,8 +30,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Position = slider.CurvePositionAt(completionProgress); } - public Action OnShake; + public Action OnShake; - protected override void Shake() => OnShake?.Invoke(); + protected override void Shake(double maximumLength) => OnShake?.Invoke(maximumLength); } } diff --git a/osu.Game/Graphics/Containers/ShakeContainer.cs b/osu.Game/Graphics/Containers/ShakeContainer.cs index 57544e8892..fde4d59f46 100644 --- a/osu.Game/Graphics/Containers/ShakeContainer.cs +++ b/osu.Game/Graphics/Containers/ShakeContainer.cs @@ -14,16 +14,26 @@ namespace osu.Game.Graphics.Containers /// /// Shake the contents of this container. /// - public void Shake() + /// The maximum length the shake should last. + public void Shake(double maximumLength) { const float shake_amount = 8; const float shake_duration = 30; - this.MoveToX(shake_amount, shake_duration / 2, Easing.OutSine).Then() - .MoveToX(-shake_amount, shake_duration, Easing.InOutSine).Then() - .MoveToX(shake_amount, shake_duration, Easing.InOutSine).Then() - .MoveToX(-shake_amount, shake_duration, Easing.InOutSine).Then() - .MoveToX(0, shake_duration / 2, Easing.InSine); + // if we don't have enough time, don't bother shaking. + if (maximumLength < shake_duration * 2) + return; + + var sequence = this.MoveToX(shake_amount, shake_duration / 2, Easing.OutSine).Then() + .MoveToX(-shake_amount, shake_duration, Easing.InOutSine).Then(); + + // if we don't have enough time for the second shake, skip it. + if (maximumLength > shake_duration * 4) + sequence = sequence + .MoveToX(shake_amount, shake_duration, Easing.InOutSine).Then() + .MoveToX(-shake_amount, shake_duration, Easing.InOutSine).Then(); + + sequence.MoveToX(0, shake_duration / 2, Easing.InSine); } } } From 3005259d506342695e7760c0ff3be9b391cf6796 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 Jul 2018 17:38:58 +0900 Subject: [PATCH 013/136] Add test for shaking --- .../TestCaseHitCircle.cs | 4 +++- .../TestCaseShaking.cs | 23 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Rulesets.Osu.Tests/TestCaseShaking.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs index 7af7140fd8..49c6978cdc 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs @@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Osu.Tests } } - private class TestDrawableHitCircle : DrawableHitCircle + protected class TestDrawableHitCircle : DrawableHitCircle { private readonly bool auto; @@ -96,6 +96,8 @@ namespace osu.Game.Rulesets.Osu.Tests this.auto = auto; } + public void TriggerJudgement() => UpdateJudgement(true); + protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (auto && !userTriggered && timeOffset > 0) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseShaking.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseShaking.cs new file mode 100644 index 0000000000..97978cff1e --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseShaking.cs @@ -0,0 +1,23 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.MathUtils; +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseShaking : TestCaseHitCircle + { + public override void Add(Drawable drawable) + { + base.Add(drawable); + + if (drawable is TestDrawableHitCircle hitObject) + { + Scheduler.AddDelayed(() => hitObject.TriggerJudgement(), + hitObject.HitObject.StartTime - (hitObject.HitObject.HitWindows.HalfWindowFor(HitResult.Miss) + RNG.Next(0, 300)) - Time.Current); + } + } + } +} From 7b4616c6c1799c339585fd84afcabf7c62a1c37d Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Fri, 20 Jul 2018 14:02:02 +0300 Subject: [PATCH 014/136] Add circular button file --- .../Components/OsuSetupCircularButton.cs | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupCircularButton.cs diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupCircularButton.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupCircularButton.cs new file mode 100644 index 0000000000..ae22f38a08 --- /dev/null +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupCircularButton.cs @@ -0,0 +1,133 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using System; + +namespace osu.Game.Screens.Edit.Screens.Setup.Components +{ + public class OsuSetupCircularButton : Container, IHasAccentColour + { + private readonly Box fill; + private readonly OsuSpriteText label; + + public const float DEFAULT_LABEL_TEXT_SIZE = 14; + public const float SIZE_X = 125; + public const float SIZE_Y = 30; + + public event Action ButtonClicked; + + private bool disabled; + public bool Disabled + { + get => disabled; + set + { + disabled = value; + fadeColour(); + } + } + + private Color4 defaultColour; + public Color4 DefaultColour + { + get => defaultColour; + set + { + defaultColour = value; + fadeColour(); + } + } + + private Color4 accentColour; + public Color4 AccentColour + { + get => accentColour; + set + { + accentColour = value; + fill.Colour = value; + } + } + + private string labelText; + public string LabelText + { + get => labelText; + set + { + labelText = value; + label.Text = value; + } + } + + public OsuSetupCircularButton() + { + Size = new Vector2(SIZE_X, SIZE_Y); + CornerRadius = 15; + Masking = true; + + Children = new Drawable[] + { + fill = new Box + { + RelativeSizeAxes = Axes.Both, + AlwaysPresent = true, + }, + label = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Colour = Color4.White, + TextSize = DEFAULT_LABEL_TEXT_SIZE, + Text = LabelText, + Font = @"Exo2.0-Bold", + } + }; + } + + protected override void LoadComplete() + { + FadeEdgeEffectTo(0); + } + + protected override bool OnClick(InputState state) + { + // Effect to indicate the button has been clicked + if (!disabled) + ButtonClicked?.Invoke(); + return base.OnClick(state); + } + + protected override bool OnHover(InputState state) + { + fadeColour(); + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + fadeColour(); + base.OnHoverLost(state); + } + + private void fadeColour() + { + if (!disabled) + { + this.FadeAccent(defaultColour.Lighten(IsHovered ? 0.3f : 0), 500, Easing.OutQuint); + this.FadeTo(1, 500, Easing.OutQuint); + } + else + this.FadeTo(0.3f, 500, Easing.OutQuint); + } + } +} From 4d0d4523ca83c47346758532f28bcfade7c044ae Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 11:23:38 +0300 Subject: [PATCH 015/136] Add test case, rename component --- .../TestCaseEditorSetupCircularButton.cs | 38 +++++++++++++++++++ ...rcularButton.cs => SetupCircularButton.cs} | 4 +- 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs rename osu.Game/Screens/Edit/Screens/Setup/Components/{OsuSetupCircularButton.cs => SetupCircularButton.cs} (96%) diff --git a/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs b/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs new file mode 100644 index 0000000000..77cc6dbb9d --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs @@ -0,0 +1,38 @@ +// Copyright (c) 2007-2018 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.Graphics; +using osu.Game.Screens.Edit.Screens.Setup.Components; +using System; +using System.Collections.Generic; + +namespace osu.Game.Tests.Visual +{ + public class TestCaseEditorSetupCircularButton : OsuTestCase + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(SetupCircularButton) + }; + + private readonly SetupCircularButton circularButton; + + public TestCaseEditorSetupCircularButton() + { + Child = circularButton = new SetupCircularButton + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + LabelText = "Button", + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour osuColour) + { + circularButton.DefaultColour = osuColour.Blue; + } + } +} diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupCircularButton.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs similarity index 96% rename from osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupCircularButton.cs rename to osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs index ae22f38a08..877c398be8 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupCircularButton.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs @@ -14,7 +14,7 @@ using System; namespace osu.Game.Screens.Edit.Screens.Setup.Components { - public class OsuSetupCircularButton : Container, IHasAccentColour + public class SetupCircularButton : Container, IHasAccentColour { private readonly Box fill; private readonly OsuSpriteText label; @@ -69,7 +69,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components } } - public OsuSetupCircularButton() + public SetupCircularButton() { Size = new Vector2(SIZE_X, SIZE_Y); CornerRadius = 15; From ebf14c9c936a205e5ad4ac4193868250cc95b2ca Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 11:32:24 +0300 Subject: [PATCH 016/136] Update framework from current master --- .../Edit/Screens/Setup/Components/SetupCircularButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs index 877c398be8..da238398fa 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs @@ -7,7 +7,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using System; From 2a819a53c093c3d28e1e7c4e79a089a36ec4a2f7 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Fri, 27 Jul 2018 12:26:37 +0300 Subject: [PATCH 017/136] Prefer inheriting TriangleButton instead of Container --- .../TestCaseEditorSetupCircularButton.cs | 5 +- .../Setup/Components/SetupCircularButton.cs | 74 ++++--------------- 2 files changed, 17 insertions(+), 62 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs b/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs index 77cc6dbb9d..14649e9d79 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs +++ b/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs @@ -27,12 +27,15 @@ namespace osu.Game.Tests.Visual Origin = Anchor.Centre, LabelText = "Button", }; + + AddStep("Enable button", () => circularButton.Enabled.Value = true); + AddStep("Disable button", () => circularButton.Enabled.Value = false); } [BackgroundDependencyLoader] private void load(OsuColour osuColour) { - circularButton.DefaultColour = osuColour.Blue; + circularButton.AccentColour = osuColour.Blue; } } } diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs index da238398fa..186d1cc223 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs @@ -3,6 +3,7 @@ using OpenTK; using OpenTK.Graphics; +using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -10,11 +11,12 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using System; namespace osu.Game.Screens.Edit.Screens.Setup.Components { - public class SetupCircularButton : Container, IHasAccentColour + public class SetupCircularButton : TriangleButton, IHasAccentColour { private readonly Box fill; private readonly OsuSpriteText label; @@ -25,28 +27,6 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components public event Action ButtonClicked; - private bool disabled; - public bool Disabled - { - get => disabled; - set - { - disabled = value; - fadeColour(); - } - } - - private Color4 defaultColour; - public Color4 DefaultColour - { - get => defaultColour; - set - { - defaultColour = value; - fadeColour(); - } - } - private Color4 accentColour; public Color4 AccentColour { @@ -57,23 +37,16 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components fill.Colour = value; } } - - private string labelText; + public string LabelText { - get => labelText; - set - { - labelText = value; - label.Text = value; - } + get => label.Text; + set => label.Text = value; } public SetupCircularButton() { Size = new Vector2(SIZE_X, SIZE_Y); - CornerRadius = 15; - Masking = true; Children = new Drawable[] { @@ -88,46 +61,25 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components Origin = Anchor.Centre, Colour = Color4.White, TextSize = DEFAULT_LABEL_TEXT_SIZE, - Text = LabelText, Font = @"Exo2.0-Bold", } }; + + Enabled.Value = true; } - protected override void LoadComplete() + [BackgroundDependencyLoader] + private void load(OsuColour colours) { - FadeEdgeEffectTo(0); + Triangles.Alpha = 0; + Content.CornerRadius = 15; } protected override bool OnClick(InputState state) { - // Effect to indicate the button has been clicked - if (!disabled) + if (Enabled.Value) ButtonClicked?.Invoke(); return base.OnClick(state); } - - protected override bool OnHover(InputState state) - { - fadeColour(); - return base.OnHover(state); - } - - protected override void OnHoverLost(InputState state) - { - fadeColour(); - base.OnHoverLost(state); - } - - private void fadeColour() - { - if (!disabled) - { - this.FadeAccent(defaultColour.Lighten(IsHovered ? 0.3f : 0), 500, Easing.OutQuint); - this.FadeTo(1, 500, Easing.OutQuint); - } - else - this.FadeTo(0.3f, 500, Easing.OutQuint); - } } } From 3ee1353976c7647e24104f86e657ea1a9af1a664 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Fri, 27 Jul 2018 12:28:47 +0300 Subject: [PATCH 018/136] Remove whitespace --- .../Edit/Screens/Setup/Components/SetupCircularButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs index 186d1cc223..51f67b2f27 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs @@ -37,7 +37,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components fill.Colour = value; } } - + public string LabelText { get => label.Text; From 78cde951323e20a7543b41737e4ee5dc7e9eca0f Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Fri, 27 Jul 2018 12:34:11 +0300 Subject: [PATCH 019/136] Privatise constants --- .../Screens/Setup/Components/SetupCircularButton.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs index 51f67b2f27..cb4f5b6864 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs @@ -21,9 +21,9 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components private readonly Box fill; private readonly OsuSpriteText label; - public const float DEFAULT_LABEL_TEXT_SIZE = 14; - public const float SIZE_X = 125; - public const float SIZE_Y = 30; + private const float default_label_text_size = 14; + private const float size_x = 125; + private const float size_y = 30; public event Action ButtonClicked; @@ -46,7 +46,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components public SetupCircularButton() { - Size = new Vector2(SIZE_X, SIZE_Y); + Size = new Vector2(size_x, size_y); Children = new Drawable[] { @@ -60,7 +60,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components Anchor = Anchor.Centre, Origin = Anchor.Centre, Colour = Color4.White, - TextSize = DEFAULT_LABEL_TEXT_SIZE, + TextSize = default_label_text_size, Font = @"Exo2.0-Bold", } }; From 1962797e206563a113755ca9e905e84bd7221bcf Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Fri, 27 Jul 2018 12:40:38 +0300 Subject: [PATCH 020/136] Remove unnecessary using directive --- .../Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs index cb4f5b6864..cd748df005 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs @@ -4,7 +4,6 @@ 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.Shapes; From 93cf063c97b1da6bc22732594d76fe796f16a4fd Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Fri, 27 Jul 2018 12:52:33 +0300 Subject: [PATCH 021/136] Remove useless things --- .../Edit/Screens/Setup/Components/SetupCircularButton.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs index cd748df005..873a176d3d 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs @@ -5,7 +5,6 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.States; using osu.Game.Graphics; @@ -68,7 +67,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load() { Triangles.Alpha = 0; Content.CornerRadius = 15; From c5a772bbc8c7035fd3c7bb45f1b8390af1b4d107 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 31 Jul 2018 15:49:04 +0900 Subject: [PATCH 022/136] Completely reuse TriangleButton --- .../TestCaseEditorSetupCircularButton.cs | 15 ++--- .../Setup/Components/SetupCircularButton.cs | 58 +------------------ 2 files changed, 5 insertions(+), 68 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs b/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs index 14649e9d79..ce3ae349b9 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs +++ b/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs @@ -1,9 +1,7 @@ // Copyright (c) 2007-2018 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.Graphics; using osu.Game.Screens.Edit.Screens.Setup.Components; using System; using System.Collections.Generic; @@ -17,25 +15,20 @@ namespace osu.Game.Tests.Visual typeof(SetupCircularButton) }; - private readonly SetupCircularButton circularButton; - public TestCaseEditorSetupCircularButton() { + SetupCircularButton circularButton; + Child = circularButton = new SetupCircularButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, - LabelText = "Button", + Text = "Button", + Action = () => { } }; AddStep("Enable button", () => circularButton.Enabled.Value = true); AddStep("Disable button", () => circularButton.Enabled.Value = false); } - - [BackgroundDependencyLoader] - private void load(OsuColour osuColour) - { - circularButton.AccentColour = osuColour.Blue; - } } } diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs index 873a176d3d..0697e62224 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs @@ -2,68 +2,19 @@ // 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.Graphics; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using System; namespace osu.Game.Screens.Edit.Screens.Setup.Components { - public class SetupCircularButton : TriangleButton, IHasAccentColour + public class SetupCircularButton : TriangleButton { - private readonly Box fill; - private readonly OsuSpriteText label; - - private const float default_label_text_size = 14; private const float size_x = 125; private const float size_y = 30; - public event Action ButtonClicked; - - private Color4 accentColour; - public Color4 AccentColour - { - get => accentColour; - set - { - accentColour = value; - fill.Colour = value; - } - } - - public string LabelText - { - get => label.Text; - set => label.Text = value; - } - public SetupCircularButton() { Size = new Vector2(size_x, size_y); - - Children = new Drawable[] - { - fill = new Box - { - RelativeSizeAxes = Axes.Both, - AlwaysPresent = true, - }, - label = new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Colour = Color4.White, - TextSize = default_label_text_size, - Font = @"Exo2.0-Bold", - } - }; - - Enabled.Value = true; } [BackgroundDependencyLoader] @@ -72,12 +23,5 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components Triangles.Alpha = 0; Content.CornerRadius = 15; } - - protected override bool OnClick(InputState state) - { - if (Enabled.Value) - ButtonClicked?.Invoke(); - return base.OnClick(state); - } } } From c9d43328465d3c31b5d01071d3e868399b650284 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 31 Jul 2018 16:44:20 +0900 Subject: [PATCH 023/136] size_x, size_y -> width, height --- .../Edit/Screens/Setup/Components/SetupCircularButton.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs index 0697e62224..37cc742ad2 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs @@ -9,12 +9,12 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components { public class SetupCircularButton : TriangleButton { - private const float size_x = 125; - private const float size_y = 30; + private const float width = 125; + private const float height = 30; public SetupCircularButton() { - Size = new Vector2(size_x, size_y); + Size = new Vector2(width, height); } [BackgroundDependencyLoader] From 7c60c74d46bdfb195edd3e738b47eb5284ce582b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 1 Aug 2018 16:07:58 +0900 Subject: [PATCH 024/136] Remove testcase --- .../TestCaseEditorSetupCircularButton.cs | 34 ------------------- 1 file changed, 34 deletions(-) delete mode 100644 osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs diff --git a/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs b/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs deleted file mode 100644 index ce3ae349b9..0000000000 --- a/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics; -using osu.Game.Screens.Edit.Screens.Setup.Components; -using System; -using System.Collections.Generic; - -namespace osu.Game.Tests.Visual -{ - public class TestCaseEditorSetupCircularButton : OsuTestCase - { - public override IReadOnlyList RequiredTypes => new[] - { - typeof(SetupCircularButton) - }; - - public TestCaseEditorSetupCircularButton() - { - SetupCircularButton circularButton; - - Child = circularButton = new SetupCircularButton - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Text = "Button", - Action = () => { } - }; - - AddStep("Enable button", () => circularButton.Enabled.Value = true); - AddStep("Disable button", () => circularButton.Enabled.Value = false); - } - } -} From b9814b64ed4836d1f2e61700095ac418d6a419fb Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 1 Aug 2018 16:45:48 +0900 Subject: [PATCH 025/136] Move default button implementation from TriangleButton to OsuButton --- osu.Game/Graphics/UserInterface/OsuButton.cs | 75 +++++++++++++++++- .../Graphics/UserInterface/TriangleButton.cs | 79 ++----------------- osu.Game/Overlays/Settings/SidebarButton.cs | 6 +- 3 files changed, 84 insertions(+), 76 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index bf3805a44d..bb6a032a12 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -1,7 +1,16 @@ // Copyright (c) 2007-2018 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.Shapes; +using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; +using osu.Game.Graphics.Sprites; +using OpenTK.Graphics; namespace osu.Game.Graphics.UserInterface { @@ -10,9 +19,73 @@ namespace osu.Game.Graphics.UserInterface /// public class OsuButton : Button { + private Box hover; + public OsuButton() { - Add(new HoverClickSounds(HoverSampleSet.Loud)); + Height = 40; + + Content.Masking = true; + Content.CornerRadius = 5; } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + BackgroundColour = colours.BlueDark; + + AddRange(new Drawable[] + { + hover = new Box + { + RelativeSizeAxes = Axes.Both, + Blending = BlendingMode.Additive, + Colour = Color4.White.Opacity(0.1f), + Alpha = 0, + Depth = -1 + }, + new HoverClickSounds(HoverSampleSet.Loud), + }); + + Enabled.ValueChanged += enabled_ValueChanged; + Enabled.TriggerChange(); + } + + private void enabled_ValueChanged(bool enabled) + { + this.FadeColour(enabled ? Color4.White : Color4.Gray, 200, Easing.OutQuint); + } + + protected override bool OnHover(InputState state) + { + hover.FadeIn(200); + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + hover.FadeOut(200); + base.OnHoverLost(state); + } + + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + { + Content.ScaleTo(0.9f, 4000, Easing.OutQuint); + return base.OnMouseDown(state, args); + } + + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + { + Content.ScaleTo(1, 1000, Easing.OutElastic); + return base.OnMouseUp(state, args); + } + + protected override SpriteText CreateText() => new OsuSpriteText + { + Depth = -1, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Font = @"Exo2.0-Bold", + }; } } diff --git a/osu.Game/Graphics/UserInterface/TriangleButton.cs b/osu.Game/Graphics/UserInterface/TriangleButton.cs index bfdc0c3bef..e85ef9dac1 100644 --- a/osu.Game/Graphics/UserInterface/TriangleButton.cs +++ b/osu.Game/Graphics/UserInterface/TriangleButton.cs @@ -2,17 +2,10 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -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.Shapes; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; using osu.Game.Graphics.Backgrounds; -using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.UserInterface { @@ -21,80 +14,19 @@ namespace osu.Game.Graphics.UserInterface /// public class TriangleButton : OsuButton, IFilterable { - private Box hover; - - protected Triangles Triangles; - - public TriangleButton() - { - Height = 40; - } - - protected override SpriteText CreateText() => new OsuSpriteText - { - Depth = -1, - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Font = @"Exo2.0-Bold", - }; + protected Triangles Triangles { get; private set; } [BackgroundDependencyLoader] private void load(OsuColour colours) { - BackgroundColour = colours.BlueDark; - - Content.Masking = true; - Content.CornerRadius = 5; - - AddRange(new Drawable[] + Add(Triangles = new Triangles { - Triangles = new Triangles - { - RelativeSizeAxes = Axes.Both, - ColourDark = colours.BlueDarker, - ColourLight = colours.Blue, - }, - hover = new Box - { - RelativeSizeAxes = Axes.Both, - Blending = BlendingMode.Additive, - Colour = Color4.White.Opacity(0.1f), - Alpha = 0, - }, + RelativeSizeAxes = Axes.Both, + ColourDark = colours.BlueDarker, + ColourLight = colours.Blue, }); - - Enabled.ValueChanged += enabled_ValueChanged; - Enabled.TriggerChange(); } - private void enabled_ValueChanged(bool enabled) - { - this.FadeColour(enabled ? Color4.White : Color4.Gray, 200, Easing.OutQuint); - } - - protected override bool OnHover(InputState state) - { - hover.FadeIn(200); - return base.OnHover(state); - } - - protected override void OnHoverLost(InputState state) - { - hover.FadeOut(200); - base.OnHoverLost(state); - } - - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) - { - Content.ScaleTo(0.9f, 4000, Easing.OutQuint); - return base.OnMouseDown(state, args); - } - - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) - { - Content.ScaleTo(1, 1000, Easing.OutElastic); - return base.OnMouseUp(state, args); - } public IEnumerable FilterTerms => new[] { Text }; @@ -105,5 +37,6 @@ namespace osu.Game.Graphics.UserInterface this.FadeTo(value ? 1 : 0); } } + } } diff --git a/osu.Game/Overlays/Settings/SidebarButton.cs b/osu.Game/Overlays/Settings/SidebarButton.cs index ac2c840c94..28e2b773ec 100644 --- a/osu.Game/Overlays/Settings/SidebarButton.cs +++ b/osu.Game/Overlays/Settings/SidebarButton.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -16,7 +17,7 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Settings { - public class SidebarButton : OsuButton + public class SidebarButton : Button { private readonly SpriteIcon drawableIcon; private readonly SpriteText headerText; @@ -97,7 +98,8 @@ namespace osu.Game.Overlays.Settings Width = 5, Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - } + }, + new HoverClickSounds(HoverSampleSet.Loud), }); } From 9eb47ae69141e0c18d94a4a6b1ed2126653c2d3a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 1 Aug 2018 17:02:52 +0900 Subject: [PATCH 026/136] Make SetupCircularButton inherit OsuButton --- .../Edit/Screens/Setup/Components/SetupCircularButton.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs index 37cc742ad2..093598be7a 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs @@ -7,7 +7,7 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Edit.Screens.Setup.Components { - public class SetupCircularButton : TriangleButton + public class SetupCircularButton : OsuButton { private const float width = 125; private const float height = 30; @@ -20,7 +20,6 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components [BackgroundDependencyLoader] private void load() { - Triangles.Alpha = 0; Content.CornerRadius = 15; } } From 10b8708d4e11314fd45c56d8307dfa648ca9f198 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 1 Aug 2018 17:47:32 +0900 Subject: [PATCH 027/136] Make SetupCircularButton adjust corner radius by height --- .../TestCaseEditorSetupCircularButton.cs | 45 +++++++++++++++++++ .../Setup/Components/SetupCircularButton.cs | 7 ++- 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs diff --git a/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs b/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs new file mode 100644 index 0000000000..c6037b706b --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs @@ -0,0 +1,45 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Graphics.Containers; +using osu.Game.Screens.Edit.Screens.Setup.Components; +using OpenTK; + +namespace osu.Game.Tests.Visual +{ + public class TestCaseEditorSetupCircularButton : OsuTestCase + { + [BackgroundDependencyLoader] + private void load() + { + Child = new FillFlowContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Children = new[] + { + new SetupCircularButton { Text = "Default" }, + new SetupCircularButton + { + Width = 200, + Text = "Wide", + }, + new SetupCircularButton + { + Height = 100, + Text = "High" + }, + new SetupCircularButton + { + Size = new Vector2(200, 100), + Text = "Wide 'n' High" + } + } + }; + } + } +} diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs index 093598be7a..d46fb2f269 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Framework.Allocation; using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Edit.Screens.Setup.Components @@ -17,10 +16,10 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components Size = new Vector2(width, height); } - [BackgroundDependencyLoader] - private void load() + protected override void Update() { - Content.CornerRadius = 15; + base.Update(); + Content.CornerRadius = DrawHeight / 2f; } } } From 123f304cf1b0e9ad1322eed614b798531db03dea Mon Sep 17 00:00:00 2001 From: jorolf Date: Thu, 2 Aug 2018 19:24:17 +0200 Subject: [PATCH 028/136] update storage usages --- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 67f02c8ac4..0ff6c3d98c 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -329,7 +329,7 @@ namespace osu.Game.Beatmaps return; } - await Task.Factory.StartNew(() => Import(stable.GetDirectories("Songs")), TaskCreationOptions.LongRunning); + await Task.Factory.StartNew(() => Import(stable.GetDirectories("Songs").Select(stable.GetUsablePathFor).ToArray()), TaskCreationOptions.LongRunning); } /// From 2ea90ef98abebc68d80724b9a1964d30cc4df2cd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Aug 2018 19:25:55 +0900 Subject: [PATCH 029/136] Add sentry logging --- osu.Desktop/Program.cs | 22 +++++++ osu.Game/OsuGame.cs | 16 +++++ osu.Game/Screens/Select/PlaySongSelect.cs | 3 + osu.Game/Utils/RavenLogger.cs | 73 +++++++++++++++++++++++ osu.Game/osu.Game.csproj | 3 +- 5 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Utils/RavenLogger.cs diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index cc08e08653..4574fb6fc9 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -4,7 +4,10 @@ using System; using System.IO; using System.Linq; +using System.Threading; +using System.Threading.Tasks; using osu.Framework; +using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.IPC; @@ -20,6 +23,8 @@ namespace osu.Desktop using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true)) { + host.ExceptionThrown += handleException; + if (!host.IsPrimaryInstance) { var importer = new ArchiveImportIPCChannel(host); @@ -45,5 +50,22 @@ namespace osu.Desktop return 0; } } + + private static int allowableExceptions = 1; + + /// + /// Allow a maximum of one unhandled exception, per second of execution. + /// + /// + /// + private static bool handleException(Exception arg) + { + bool continueExecution = Interlocked.Decrement(ref allowableExceptions) >= 0; + + Logger.Log($"Unhandled exception has been {(continueExecution ? "allowed" : "denied")} with {allowableExceptions} more allowable exceptions."); + + Task.Delay(1000).ContinueWith(_ => Interlocked.Increment(ref allowableExceptions)); + return Interlocked.Decrement(ref allowableExceptions) >= 0; + } } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 025d5f50e3..3e6317348c 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -36,6 +36,8 @@ using osu.Game.Skinning; using OpenTK.Graphics; using osu.Game.Overlays.Volume; using osu.Game.Screens.Select; +using osu.Game.Utils; +using LogLevel = osu.Framework.Logging.LogLevel; namespace osu.Game { @@ -65,6 +67,8 @@ namespace osu.Game private ScreenshotManager screenshotManager; + protected RavenLogger RavenLogger; + public virtual Storage GetStorageForStableInstall() => null; private Intro intro @@ -106,6 +110,8 @@ namespace osu.Game this.args = args; forwardLoggedErrorsToNotifications(); + + RavenLogger = new RavenLogger(this); } public void ToggleSettings() => settings.ToggleVisibility(); @@ -150,6 +156,8 @@ namespace osu.Game dependencies.CacheAs(this); + dependencies.Cache(RavenLogger); + dependencies.CacheAs(ruleset); dependencies.CacheAs>(ruleset); @@ -271,6 +279,12 @@ namespace osu.Game menu.Push(new PlayerLoader(new ReplayPlayer(s.Replay))); } + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + RavenLogger.Dispose(); + } + protected override void LoadComplete() { // this needs to be cached before base.LoadComplete as it is used by MenuCursorContainer. @@ -599,6 +613,7 @@ namespace osu.Game private void screenAdded(Screen newScreen) { currentScreen = (OsuScreen)newScreen; + Logger.Log($"Screen changed → {currentScreen}"); newScreen.ModePushed += screenAdded; newScreen.Exited += screenRemoved; @@ -607,6 +622,7 @@ namespace osu.Game private void screenRemoved(Screen newScreen) { currentScreen = (OsuScreen)newScreen; + Logger.Log($"Screen changed ← {currentScreen}"); if (newScreen == null) Exit(); diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index a346911ca2..a73254627d 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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 System.Threading.Tasks; @@ -141,6 +142,8 @@ namespace osu.Game.Screens.Select { if (player != null) return false; + throw new Exception("this is a test!"); + // Ctrl+Enter should start map with autoplay enabled. if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true) { diff --git a/osu.Game/Utils/RavenLogger.cs b/osu.Game/Utils/RavenLogger.cs new file mode 100644 index 0000000000..aadb70add8 --- /dev/null +++ b/osu.Game/Utils/RavenLogger.cs @@ -0,0 +1,73 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using osu.Framework.Logging; +using SharpRaven; +using SharpRaven.Data; + +namespace osu.Game.Utils +{ + /// + /// Report errors to sentry. + /// + public class RavenLogger : IDisposable + { + private readonly RavenClient raven = new RavenClient("https://5e342cd55f294edebdc9ad604d28bbd3@sentry.io/1255255"); + + private readonly List tasks = new List(); + + public RavenLogger(OsuGame game) + { + raven.Release = game.Version; + + Logger.NewEntry += entry => + { + if (entry.Level < LogLevel.Verbose) return; + + if (entry.Exception != null) + queuePendingTask(raven.CaptureAsync(new SentryEvent(entry.Exception))); + else + raven.AddTrail(new Breadcrumb(entry.Target.ToString(), BreadcrumbType.Navigation) { Message = entry.Message }); + }; + } + + private void queuePendingTask(Task task) + { + lock (tasks) tasks.Add(task); + task.ContinueWith(_ => + { + lock (tasks) + tasks.Remove(task); + }); + } + + #region Disposal + + ~RavenLogger() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private bool isDisposed; + + protected virtual void Dispose(bool isDisposing) + { + if (isDisposed) + return; + + isDisposed = true; + lock (tasks) Task.WaitAll(tasks.ToArray(), 5000); + } + + #endregion + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 89e80bd06b..9a7edb6ae2 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,9 +18,10 @@ - + + \ No newline at end of file From 7310c38df98396b5c51bb27febc034f26e6e8532 Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Fri, 3 Aug 2018 14:03:11 +0200 Subject: [PATCH 030/136] Add relax mod --- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 69 ++++++++++++++++++- .../Rulesets/Mods/IUpdatableByHitObject.cs | 12 ++++ .../Rulesets/Mods/IUpdatableByPlayfield.cs | 12 ++++ .../Objects/Drawables/DrawableHitObject.cs | 12 +++- osu.Game/Rulesets/UI/Playfield.cs | 17 ++++- 5 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 osu.Game/Rulesets/Mods/IUpdatableByHitObject.cs create mode 100644 osu.Game/Rulesets/Mods/IUpdatableByPlayfield.cs diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index 9f9c2a09b6..2e07117734 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -2,14 +2,81 @@ // 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.Input.States; using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Rulesets.UI; +using static osu.Game.Input.Handlers.ReplayInputHandler; namespace osu.Game.Rulesets.Osu.Mods { - public class OsuModRelax : ModRelax + public class OsuModRelax : ModRelax, IApplicableFailOverride, IUpdatableByHitObject, IUpdatableByPlayfield { public override string Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things."; public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).ToArray(); + + public bool AllowFail => false; + + private bool hitStill; + private bool hitOnce; + + public void Update(DrawableHitObject o) + { + const float relax_leniency = 3; + + if (!(o is DrawableOsuHitObject d)) + return; + + double t = d.Clock.CurrentTime; + + if (t >= d.HitObject.StartTime - relax_leniency) + { + if (d.HitObject is IHasEndTime e && t > e.EndTime || d.IsHit) + return; + + hitStill |= d is DrawableSlider s && (s.Ball.IsHovered || d.IsHovered) || d is DrawableSpinner; + + hitOnce |= d is DrawableHitCircle && d.IsHovered; + } + } + + public void Update(Playfield r) + { + var d = r.HitObjects.Objects.First(h => h is DrawableOsuHitObject) as DrawableOsuHitObject; + if (hitOnce) + { + hit(d, false); + hit(d, true); + } + hit(d, hitStill); + + hitOnce = false; + hitStill = false; + } + + private bool wasHit; + private bool wasLeft; + + private void hit(DrawableOsuHitObject d, bool hitting) + { + if (wasHit == hitting) + return; + wasHit = hitting; + + var l = new ReplayState + { + PressedActions = new List() + }; + if (hitting) + { + l.PressedActions.Add(wasLeft ? OsuAction.LeftButton : OsuAction.RightButton); + wasLeft = !wasLeft; + } + d.OsuActionInputManager.HandleCustomInput(new InputState(), l); + } } } diff --git a/osu.Game/Rulesets/Mods/IUpdatableByHitObject.cs b/osu.Game/Rulesets/Mods/IUpdatableByHitObject.cs new file mode 100644 index 0000000000..657145b911 --- /dev/null +++ b/osu.Game/Rulesets/Mods/IUpdatableByHitObject.cs @@ -0,0 +1,12 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Objects.Drawables; + +namespace osu.Game.Rulesets.Mods +{ + public interface IUpdatableByHitObject : IApplicableMod + { + void Update(DrawableHitObject o); + } +} diff --git a/osu.Game/Rulesets/Mods/IUpdatableByPlayfield.cs b/osu.Game/Rulesets/Mods/IUpdatableByPlayfield.cs new file mode 100644 index 0000000000..39781a875d --- /dev/null +++ b/osu.Game/Rulesets/Mods/IUpdatableByPlayfield.cs @@ -0,0 +1,12 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.UI; + +namespace osu.Game.Rulesets.Mods +{ + public interface IUpdatableByPlayfield : IApplicableMod + { + void Update(Playfield r); + } +} diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index a22aaa784f..31dd5a4a91 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -13,6 +13,8 @@ using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; using OpenTK.Graphics; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Objects.Drawables { @@ -41,6 +43,8 @@ namespace osu.Game.Rulesets.Objects.Drawables public IReadOnlyList Judgements => judgements; private readonly List judgements = new List(); + private WorkingBeatmap beatmap; + /// /// Whether a visible judgement should be displayed when this representation is hit. /// @@ -80,8 +84,9 @@ namespace osu.Game.Rulesets.Objects.Drawables } [BackgroundDependencyLoader] - private void load() + private void load(IBindableBeatmap b) { + beatmap = b.Value; var samples = GetSamples().ToArray(); if (samples.Any()) @@ -132,6 +137,11 @@ namespace osu.Game.Rulesets.Objects.Drawables { base.Update(); + if(beatmap != null) + foreach (var m in beatmap.Mods.Value) + if (m is IUpdatableByHitObject u) + u.Update(this); + var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; while (judgements.Count > 0) diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index 2f44d99e18..7116dc53a9 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -6,6 +6,8 @@ using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Allocation; using osu.Framework.Configuration; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.UI { @@ -42,9 +44,12 @@ namespace osu.Game.Rulesets.UI RelativeSizeAxes = Axes.Both; } + private WorkingBeatmap beatmap; + [BackgroundDependencyLoader] - private void load() + private void load(IBindableBeatmap b) { + beatmap = b.Value; HitObjects = CreateHitObjectContainer(); HitObjects.RelativeSizeAxes = Axes.Both; @@ -87,5 +92,15 @@ namespace osu.Game.Rulesets.UI /// Creates the container that will be used to contain the s. /// protected virtual HitObjectContainer CreateHitObjectContainer() => new HitObjectContainer(); + + protected override void Update() + { + base.Update(); + + if (beatmap != null) + foreach (var m in beatmap.Mods.Value) + if (m is IUpdatableByPlayfield u) + u.Update(this); + } } } From 07d6a75e239ed84169b2669eab2b1aee9c40cdc5 Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Sat, 4 Aug 2018 00:18:09 +0200 Subject: [PATCH 031/136] Rename variables to be human readable --- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 32 +++++++++---------- .../Rulesets/Mods/IUpdatableByHitObject.cs | 2 +- .../Rulesets/Mods/IUpdatableByPlayfield.cs | 2 +- .../Objects/Drawables/DrawableHitObject.cs | 10 +++--- osu.Game/Rulesets/UI/Playfield.cs | 10 +++--- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index 2e07117734..296a9f9631 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -24,35 +24,35 @@ namespace osu.Game.Rulesets.Osu.Mods private bool hitStill; private bool hitOnce; - public void Update(DrawableHitObject o) + public void Update(DrawableHitObject drawable) { const float relax_leniency = 3; - if (!(o is DrawableOsuHitObject d)) + if (!(drawable is DrawableOsuHitObject osuHit)) return; - double t = d.Clock.CurrentTime; + double time = osuHit.Clock.CurrentTime; - if (t >= d.HitObject.StartTime - relax_leniency) + if (time >= osuHit.HitObject.StartTime - relax_leniency) { - if (d.HitObject is IHasEndTime e && t > e.EndTime || d.IsHit) + if (osuHit.HitObject is IHasEndTime hasEnd && time > hasEnd.EndTime || osuHit.IsHit) return; - hitStill |= d is DrawableSlider s && (s.Ball.IsHovered || d.IsHovered) || d is DrawableSpinner; + hitStill |= osuHit is DrawableSlider slider && (slider.Ball.IsHovered || osuHit.IsHovered) || osuHit is DrawableSpinner; - hitOnce |= d is DrawableHitCircle && d.IsHovered; + hitOnce |= osuHit is DrawableHitCircle && osuHit.IsHovered; } } - public void Update(Playfield r) + public void Update(Playfield playfield) { - var d = r.HitObjects.Objects.First(h => h is DrawableOsuHitObject) as DrawableOsuHitObject; + var osuHit = playfield.HitObjects.Objects.First(d => d is DrawableOsuHitObject) as DrawableOsuHitObject; if (hitOnce) { - hit(d, false); - hit(d, true); + hit(osuHit, false); + hit(osuHit, true); } - hit(d, hitStill); + hit(osuHit, hitStill); hitOnce = false; hitStill = false; @@ -61,22 +61,22 @@ namespace osu.Game.Rulesets.Osu.Mods private bool wasHit; private bool wasLeft; - private void hit(DrawableOsuHitObject d, bool hitting) + private void hit(DrawableOsuHitObject osuHit, bool hitting) { if (wasHit == hitting) return; wasHit = hitting; - var l = new ReplayState + var state = new ReplayState { PressedActions = new List() }; if (hitting) { - l.PressedActions.Add(wasLeft ? OsuAction.LeftButton : OsuAction.RightButton); + state.PressedActions.Add(wasLeft ? OsuAction.LeftButton : OsuAction.RightButton); wasLeft = !wasLeft; } - d.OsuActionInputManager.HandleCustomInput(new InputState(), l); + osuHit.OsuActionInputManager.HandleCustomInput(new InputState(), state); } } } diff --git a/osu.Game/Rulesets/Mods/IUpdatableByHitObject.cs b/osu.Game/Rulesets/Mods/IUpdatableByHitObject.cs index 657145b911..6dd900e9c5 100644 --- a/osu.Game/Rulesets/Mods/IUpdatableByHitObject.cs +++ b/osu.Game/Rulesets/Mods/IUpdatableByHitObject.cs @@ -7,6 +7,6 @@ namespace osu.Game.Rulesets.Mods { public interface IUpdatableByHitObject : IApplicableMod { - void Update(DrawableHitObject o); + void Update(DrawableHitObject drawable); } } diff --git a/osu.Game/Rulesets/Mods/IUpdatableByPlayfield.cs b/osu.Game/Rulesets/Mods/IUpdatableByPlayfield.cs index 39781a875d..be879759bd 100644 --- a/osu.Game/Rulesets/Mods/IUpdatableByPlayfield.cs +++ b/osu.Game/Rulesets/Mods/IUpdatableByPlayfield.cs @@ -7,6 +7,6 @@ namespace osu.Game.Rulesets.Mods { public interface IUpdatableByPlayfield : IApplicableMod { - void Update(Playfield r); + void Update(Playfield playfield); } } diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 31dd5a4a91..f060f7382c 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -84,9 +84,9 @@ namespace osu.Game.Rulesets.Objects.Drawables } [BackgroundDependencyLoader] - private void load(IBindableBeatmap b) + private void load(IBindableBeatmap bBeatmap) { - beatmap = b.Value; + beatmap = bBeatmap.Value; var samples = GetSamples().ToArray(); if (samples.Any()) @@ -138,9 +138,9 @@ namespace osu.Game.Rulesets.Objects.Drawables base.Update(); if(beatmap != null) - foreach (var m in beatmap.Mods.Value) - if (m is IUpdatableByHitObject u) - u.Update(this); + foreach (var mod in beatmap.Mods.Value) + if (mod is IUpdatableByHitObject updatable) + updatable.Update(this); var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index 7116dc53a9..f7b3736e74 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -47,9 +47,9 @@ namespace osu.Game.Rulesets.UI private WorkingBeatmap beatmap; [BackgroundDependencyLoader] - private void load(IBindableBeatmap b) + private void load(IBindableBeatmap bBeatmap) { - beatmap = b.Value; + beatmap = bBeatmap.Value; HitObjects = CreateHitObjectContainer(); HitObjects.RelativeSizeAxes = Axes.Both; @@ -98,9 +98,9 @@ namespace osu.Game.Rulesets.UI base.Update(); if (beatmap != null) - foreach (var m in beatmap.Mods.Value) - if (m is IUpdatableByPlayfield u) - u.Update(this); + foreach (var mod in beatmap.Mods.Value) + if (mod is IUpdatableByPlayfield updatable) + updatable.Update(this); } } } From b1d1a2400bfc49c47649ea497cb0437a0467abcd Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Sun, 5 Aug 2018 09:52:19 +0200 Subject: [PATCH 032/136] Remove IUpdatableByHitObject completely --- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 60 +++++++++---------- .../Rulesets/Mods/IUpdatableByHitObject.cs | 12 ---- .../Objects/Drawables/DrawableHitObject.cs | 12 +--- 3 files changed, 29 insertions(+), 55 deletions(-) delete mode 100644 osu.Game/Rulesets/Mods/IUpdatableByHitObject.cs diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index 296a9f9631..e10ddfaec1 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Input.States; using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.UI; @@ -14,48 +13,45 @@ using static osu.Game.Input.Handlers.ReplayInputHandler; namespace osu.Game.Rulesets.Osu.Mods { - public class OsuModRelax : ModRelax, IApplicableFailOverride, IUpdatableByHitObject, IUpdatableByPlayfield + public class OsuModRelax : ModRelax, IApplicableFailOverride, IUpdatableByPlayfield { public override string Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things."; public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).ToArray(); public bool AllowFail => false; - private bool hitStill; - private bool hitOnce; - - public void Update(DrawableHitObject drawable) - { - const float relax_leniency = 3; - - if (!(drawable is DrawableOsuHitObject osuHit)) - return; - - double time = osuHit.Clock.CurrentTime; - - if (time >= osuHit.HitObject.StartTime - relax_leniency) - { - if (osuHit.HitObject is IHasEndTime hasEnd && time > hasEnd.EndTime || osuHit.IsHit) - return; - - hitStill |= osuHit is DrawableSlider slider && (slider.Ball.IsHovered || osuHit.IsHovered) || osuHit is DrawableSpinner; - - hitOnce |= osuHit is DrawableHitCircle && osuHit.IsHovered; - } - } - public void Update(Playfield playfield) { - var osuHit = playfield.HitObjects.Objects.First(d => d is DrawableOsuHitObject) as DrawableOsuHitObject; + bool hitStill = false; + bool hitOnce = false; + + const float relax_leniency = 3; + + foreach (var drawable in playfield.HitObjects.Objects) + { + if (!(drawable is DrawableOsuHitObject osuHit)) + continue; + + double time = osuHit.Clock.CurrentTime; + + if (osuHit.IsAlive && time >= osuHit.HitObject.StartTime - relax_leniency) + { + if (osuHit.HitObject is IHasEndTime hasEnd && time > hasEnd.EndTime || osuHit.IsHit) + continue; + + hitStill |= osuHit is DrawableSlider slider && (slider.Ball.IsHovered || osuHit.IsHovered) || osuHit is DrawableSpinner; + + hitOnce |= osuHit is DrawableHitCircle && osuHit.IsHovered; + } + } + + var osuHitSample = playfield.HitObjects.Objects.First(d => d is DrawableOsuHitObject) as DrawableOsuHitObject; if (hitOnce) { - hit(osuHit, false); - hit(osuHit, true); + hit(osuHitSample, false); + hit(osuHitSample, true); } - hit(osuHit, hitStill); - - hitOnce = false; - hitStill = false; + hit(osuHitSample, hitStill); } private bool wasHit; diff --git a/osu.Game/Rulesets/Mods/IUpdatableByHitObject.cs b/osu.Game/Rulesets/Mods/IUpdatableByHitObject.cs deleted file mode 100644 index 6dd900e9c5..0000000000 --- a/osu.Game/Rulesets/Mods/IUpdatableByHitObject.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Rulesets.Objects.Drawables; - -namespace osu.Game.Rulesets.Mods -{ - public interface IUpdatableByHitObject : IApplicableMod - { - void Update(DrawableHitObject drawable); - } -} diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index f060f7382c..a22aaa784f 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -13,8 +13,6 @@ using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; using OpenTK.Graphics; -using osu.Game.Beatmaps; -using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Objects.Drawables { @@ -43,8 +41,6 @@ namespace osu.Game.Rulesets.Objects.Drawables public IReadOnlyList Judgements => judgements; private readonly List judgements = new List(); - private WorkingBeatmap beatmap; - /// /// Whether a visible judgement should be displayed when this representation is hit. /// @@ -84,9 +80,8 @@ namespace osu.Game.Rulesets.Objects.Drawables } [BackgroundDependencyLoader] - private void load(IBindableBeatmap bBeatmap) + private void load() { - beatmap = bBeatmap.Value; var samples = GetSamples().ToArray(); if (samples.Any()) @@ -137,11 +132,6 @@ namespace osu.Game.Rulesets.Objects.Drawables { base.Update(); - if(beatmap != null) - foreach (var mod in beatmap.Mods.Value) - if (mod is IUpdatableByHitObject updatable) - updatable.Update(this); - var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; while (judgements.Count > 0) From 924bf9174c97ec4deaae8f8d55cee174d0defbc1 Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Sun, 5 Aug 2018 09:58:15 +0200 Subject: [PATCH 033/136] Fix overclick in certain situations --- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index e10ddfaec1..f0e7891a96 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -33,6 +33,7 @@ namespace osu.Game.Rulesets.Osu.Mods continue; double time = osuHit.Clock.CurrentTime; + double relativetime = time - osuHit.HitObject.StartTime; if (osuHit.IsAlive && time >= osuHit.HitObject.StartTime - relax_leniency) { @@ -41,7 +42,7 @@ namespace osu.Game.Rulesets.Osu.Mods hitStill |= osuHit is DrawableSlider slider && (slider.Ball.IsHovered || osuHit.IsHovered) || osuHit is DrawableSpinner; - hitOnce |= osuHit is DrawableHitCircle && osuHit.IsHovered; + hitOnce |= osuHit is DrawableHitCircle && osuHit.IsHovered && osuHit.HitObject.HitWindows.CanBeHit(relativetime); } } From 2019a89a08ff12ca8c2cd822e1ba99d2be9b7f65 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Aug 2018 16:40:17 +0900 Subject: [PATCH 034/136] Softly-handle infinite loops in mania beatmap conversion --- .../Legacy/DistanceObjectPatternGenerator.cs | 37 +++++++++++++++---- .../Legacy/EndTimeObjectPatternGenerator.cs | 4 +- .../Legacy/HitObjectPatternGenerator.cs | 8 ++-- .../Beatmaps/Patterns/PatternGenerator.cs | 20 ++++++++++ 4 files changed, 57 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 8d0d78120a..010cf962cc 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -176,16 +176,23 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int nextColumn = Random.Next(RandomStart, TotalColumns); for (int i = 0; i < Math.Min(usableColumns, noteCount); i++) { - while (pattern.ColumnHasObject(nextColumn) || PreviousPattern.ColumnHasObject(nextColumn)) //find available column + // Find available column + RunWhile(() => pattern.ColumnHasObject(nextColumn) || PreviousPattern.ColumnHasObject(nextColumn), () => + { nextColumn = Random.Next(RandomStart, TotalColumns); + }); + addToPattern(pattern, nextColumn, startTime, EndTime); } // This is can't be combined with the above loop due to RNG for (int i = 0; i < noteCount - usableColumns; i++) { - while (pattern.ColumnHasObject(nextColumn)) + RunWhile(() => pattern.ColumnHasObject(nextColumn), () => + { nextColumn = Random.Next(RandomStart, TotalColumns); + }); + addToPattern(pattern, nextColumn, startTime, EndTime); } @@ -211,16 +218,21 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns) { - while (PreviousPattern.ColumnHasObject(nextColumn)) + RunWhile(() => PreviousPattern.ColumnHasObject(nextColumn), () => + { nextColumn = Random.Next(RandomStart, TotalColumns); + }); } int lastColumn = nextColumn; for (int i = 0; i < noteCount; i++) { addToPattern(pattern, nextColumn, startTime, startTime); - while (nextColumn == lastColumn) + + RunWhile(() => nextColumn == lastColumn, () => + { nextColumn = Random.Next(RandomStart, TotalColumns); + }); lastColumn = nextColumn; startTime += SegmentDuration; @@ -393,14 +405,18 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns) { - while (PreviousPattern.ColumnHasObject(nextColumn)) + RunWhile(() => PreviousPattern.ColumnHasObject(nextColumn), () => + { nextColumn = Random.Next(RandomStart, TotalColumns); + }); } for (int i = 0; i < columnRepeat; i++) { - while (pattern.ColumnHasObject(nextColumn)) + RunWhile(() => pattern.ColumnHasObject(nextColumn), () => + { nextColumn = Random.Next(RandomStart, TotalColumns); + }); addToPattern(pattern, nextColumn, startTime, EndTime); startTime += SegmentDuration; @@ -427,8 +443,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int holdColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns) { - while (PreviousPattern.ColumnHasObject(holdColumn)) + RunWhile(() => PreviousPattern.ColumnHasObject(holdColumn), () => + { holdColumn = Random.Next(RandomStart, TotalColumns); + }); } // Create the hold note @@ -455,8 +473,11 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { for (int j = 0; j < noteCount; j++) { - while (rowPattern.ColumnHasObject(nextColumn) || nextColumn == holdColumn) + RunWhile(() => rowPattern.ColumnHasObject(nextColumn) || nextColumn == holdColumn, () => + { nextColumn = Random.Next(RandomStart, TotalColumns); + }); + addToPattern(rowPattern, nextColumn, startTime, startTime); } } diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs index 06b4b8a27e..eae9a0fc3b 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs @@ -59,8 +59,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { int nextColumn = Random.Next(start, TotalColumns); - while (PreviousPattern.ColumnHasObject(nextColumn)) + RunWhile(() => PreviousPattern.ColumnHasObject(nextColumn), () => + { nextColumn = Random.Next(start, TotalColumns); + }); return nextColumn; } diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index 84ebfdb839..930ca26660 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -234,7 +234,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); for (int i = 0; i < noteCount; i++) { - while (pattern.ColumnHasObject(nextColumn) || PreviousPattern.ColumnHasObject(nextColumn) && !allowStacking) + RunWhile(() => pattern.ColumnHasObject(nextColumn) || PreviousPattern.ColumnHasObject(nextColumn) && !allowStacking, () => { if (convertType.HasFlag(PatternType.Gathered)) { @@ -244,7 +244,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy } else nextColumn = Random.Next(RandomStart, TotalColumns); - } + }); addToPattern(pattern, nextColumn); } @@ -295,8 +295,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int nextColumn = Random.Next(RandomStart, columnLimit); for (int i = 0; i < noteCount; i++) { - while (pattern.ColumnHasObject(nextColumn)) + RunWhile(() => pattern.ColumnHasObject(nextColumn), () => + { nextColumn = Random.Next(RandomStart, columnLimit); + }); // Add normal note addToPattern(pattern, nextColumn); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs index a42d57cdd1..74164d70c1 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs @@ -3,6 +3,9 @@ using System; using System.Collections.Generic; +using System.Diagnostics; +using JetBrains.Annotations; +using osu.Framework.Logging; using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns @@ -12,6 +15,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns /// internal abstract class PatternGenerator { + private const int max_rng_iterations = 100; + /// /// The last pattern. /// @@ -42,6 +47,21 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns TotalColumns = Beatmap.TotalColumns; } + protected void RunWhile([InstantHandle] Func condition, Action action) + { + int iterations = 0; + + while (condition() && iterations++ < max_rng_iterations) + action(); + + if (iterations < max_rng_iterations) + return; + + // Generate + log an error/stacktrace + + Logger.Log($"Allowable time exceeded for hitobject generation:\n{new StackTrace(0)}", level: LogLevel.Error); + } + /// /// Generates the patterns for , each filled with hit objects. /// From f69bc23ab82a231ccd44abb9ae0115fe123bb80d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Aug 2018 17:26:25 +0900 Subject: [PATCH 035/136] Overflow mod select to account for parallax --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 45703ac56d..9dd6cefc34 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -27,6 +27,7 @@ namespace osu.Game.Overlays.Mods { public class ModSelectOverlay : WaveOverlayContainer { + private const float overflow_padding = 50; private const float content_width = 0.8f; protected Color4 LowMultiplierColour, HighMultiplierColour; @@ -199,6 +200,11 @@ namespace osu.Game.Overlays.Mods Waves.FourthWaveColour = OsuColour.FromHex(@"003a4e"); Height = 510; + Padding = new MarginPadding + { + Left = -overflow_padding, + Right = -overflow_padding + }; Children = new Drawable[] { @@ -258,6 +264,11 @@ namespace osu.Game.Overlays.Mods AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Width = content_width, + Padding = new MarginPadding + { + Left = overflow_padding, + Right = overflow_padding + }, Children = new Drawable[] { new OsuSpriteText @@ -295,7 +306,12 @@ namespace osu.Game.Overlays.Mods Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Vertical = 10 }, + Padding = new MarginPadding + { + Vertical = 10, + Left = overflow_padding, + Right = overflow_padding + }, Child = ModSectionsContainer = new FillFlowContainer { Origin = Anchor.TopCentre, @@ -341,7 +357,9 @@ namespace osu.Game.Overlays.Mods Direction = FillDirection.Horizontal, Padding = new MarginPadding { - Vertical = 15 + Vertical = 15, + Left = overflow_padding, + Right = overflow_padding }, Children = new Drawable[] { From e04b2f4fa9261d0cf84028fe761361641d8cbcea Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Aug 2018 18:31:32 +0900 Subject: [PATCH 036/136] Fix hitobject results not rewinding --- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 2abb2eb289..7e3e955740 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -147,17 +147,15 @@ namespace osu.Game.Rulesets.Objects.Drawables /// public void PlaySamples() => Samples?.Play(); - private double lastUpdateTime; - protected override void Update() { base.Update(); - if (Result != null && lastUpdateTime > Time.Current) + if (Result != null && Result.HasResult) { var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; - if (Result.TimeOffset + endTime < Time.Current) + if (Result.TimeOffset + endTime > Time.Current) { OnRevertResult?.Invoke(this, Result); @@ -165,8 +163,6 @@ namespace osu.Game.Rulesets.Objects.Drawables State.Value = ArmedState.Idle; } } - - lastUpdateTime = Time.Current; } protected override void UpdateAfterChildren() From 8be5a606bf0c9a4ba5c21f0056b3e161e7efd269 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Aug 2018 18:33:07 +0900 Subject: [PATCH 037/136] Fix swells possibly being strong hitobjects --- osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 41972b5d20..acd6d43284 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -168,7 +168,6 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps { StartTime = obj.StartTime, Samples = obj.Samples, - IsStrong = strong, Duration = endTimeData.Duration, RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier) }; From 7c3556baf8312faee499f8a075dbedfd8095ed41 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 09:12:29 +0900 Subject: [PATCH 038/136] Throw exception when Swell.IsStrong is set --- osu.Game.Rulesets.Taiko/Objects/Swell.cs | 3 +++ osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs index c3ea71af3f..702bf63bf5 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Swell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Taiko.Objects @@ -16,6 +17,8 @@ namespace osu.Game.Rulesets.Taiko.Objects /// public int RequiredHits = 10; + public override bool IsStrong { set => throw new NotSupportedException($"{nameof(Swell)} cannot be a strong hitobject."); } + protected override void CreateNestedHitObjects() { base.CreateNestedHitObjects(); diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs index 6948c5bcde..9c86b60688 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Taiko.Objects /// Whether this HitObject is a "strong" type. /// Strong hit objects give more points for hitting the hit object with both keys. /// - public bool IsStrong; + public virtual bool IsStrong { get; set; } protected override void CreateNestedHitObjects() { From aa3f6337a22d2aff4a74d2175a13a70761c4c29c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 09:14:07 +0900 Subject: [PATCH 039/136] Add comment --- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 9dd6cefc34..e83dedaf35 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -27,7 +27,11 @@ namespace osu.Game.Overlays.Mods { public class ModSelectOverlay : WaveOverlayContainer { + /// + /// How much this container should overflow the sides of the screen to account for parallax shifting. + /// private const float overflow_padding = 50; + private const float content_width = 0.8f; protected Color4 LowMultiplierColour, HighMultiplierColour; From 26d4bb5451639c844487d4b62cc8d6d83e5d870a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 09:51:02 +0900 Subject: [PATCH 040/136] xmldoc + reword --- .../Beatmaps/Patterns/PatternGenerator.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs index 74164d70c1..3434c9f01e 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs @@ -15,7 +15,11 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns /// internal abstract class PatternGenerator { - private const int max_rng_iterations = 100; + /// + /// An arbitrary maximum amount of iterations to perform in . + /// The specific value is not super important - enough such that no false-positives occur. + /// + private const int max_rng_iterations = 20; /// /// The last pattern. @@ -59,7 +63,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns // Generate + log an error/stacktrace - Logger.Log($"Allowable time exceeded for hitobject generation:\n{new StackTrace(0)}", level: LogLevel.Error); + Logger.Log($"Allowable iterations ({max_rng_iterations}) exceeded:\n{new StackTrace(0)}", level: LogLevel.Error); } /// From ce77473910f4b24cd0d6c608295f96d2fea9f1d9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 10:24:56 +0900 Subject: [PATCH 041/136] Simplify usage of ConvertHitObjectParser --- .../Beatmaps/Formats/LegacyBeatmapDecoder.cs | 12 +++++----- .../Legacy/Catch/ConvertHitObjectParser.cs | 5 ++++ .../Objects/Legacy/ConvertHitObjectParser.cs | 23 ++++++++++++++----- .../Legacy/Mania/ConvertHitObjectParser.cs | 5 ++++ .../Legacy/Osu/ConvertHitObjectParser.cs | 5 ++++ .../Legacy/Taiko/ConvertHitObjectParser.cs | 5 ++++ 6 files changed, 43 insertions(+), 12 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 29be751de2..31a7698f50 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -126,16 +126,16 @@ namespace osu.Game.Beatmaps.Formats switch (beatmap.BeatmapInfo.RulesetID) { case 0: - parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(); + parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(getOffsetTime(), FormatVersion); break; case 1: - parser = new Rulesets.Objects.Legacy.Taiko.ConvertHitObjectParser(); + parser = new Rulesets.Objects.Legacy.Taiko.ConvertHitObjectParser(getOffsetTime(), FormatVersion); break; case 2: - parser = new Rulesets.Objects.Legacy.Catch.ConvertHitObjectParser(); + parser = new Rulesets.Objects.Legacy.Catch.ConvertHitObjectParser(getOffsetTime(), FormatVersion); break; case 3: - parser = new Rulesets.Objects.Legacy.Mania.ConvertHitObjectParser(); + parser = new Rulesets.Objects.Legacy.Mania.ConvertHitObjectParser(getOffsetTime(), FormatVersion); break; } @@ -405,9 +405,9 @@ namespace osu.Game.Beatmaps.Formats { // If the ruleset wasn't specified, assume the osu!standard ruleset. if (parser == null) - parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(); + parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(getOffsetTime(), FormatVersion); - var obj = parser.Parse(line, getOffsetTime()); + var obj = parser.Parse(line); if (obj != null) { diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs index c7451dc978..46be5ff3a5 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs @@ -13,6 +13,11 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch /// public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser { + public ConvertHitObjectParser(double offset, int formatVersion) + : base(offset, formatVersion) + { + } + protected override HitObject CreateHit(Vector2 position, bool newCombo) { return new ConvertHit diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index c48060bfa9..4919aaea2b 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -19,12 +19,23 @@ namespace osu.Game.Rulesets.Objects.Legacy /// public abstract class ConvertHitObjectParser : HitObjectParser { - public override HitObject Parse(string text) + /// + /// The offset to apply to all time values. + /// + public double Offset; + + /// + /// The beatmap version. + /// + public int FormatVersion = LegacyBeatmapDecoder.LATEST_VERSION; + + protected ConvertHitObjectParser(double offset, int formatVersion) { - return Parse(text, 0); + Offset = offset; + formatVersion = formatVersion; } - public HitObject Parse(string text, double offset) + public override HitObject Parse(string text) { try { @@ -152,7 +163,7 @@ namespace osu.Game.Rulesets.Objects.Legacy } else if (type.HasFlag(ConvertHitObjectType.Spinner)) { - result = CreateSpinner(new Vector2(512, 384) / 2, Convert.ToDouble(split[5], CultureInfo.InvariantCulture) + offset); + result = CreateSpinner(new Vector2(512, 384) / 2, Convert.ToDouble(split[5], CultureInfo.InvariantCulture) + Offset); if (split.Length > 6) readCustomSampleBanks(split[6], bankInfo); @@ -170,13 +181,13 @@ namespace osu.Game.Rulesets.Objects.Legacy readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo); } - result = CreateHold(pos, combo, endTime + offset); + result = CreateHold(pos, combo, endTime + Offset); } if (result == null) throw new InvalidOperationException($@"Unknown hit object type {type}."); - result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture) + offset; + result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture) + Offset; result.Samples = convertSoundType(soundType, bankInfo); return result; diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs index 99ba1304e8..e4d4fc4687 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs @@ -13,6 +13,11 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania /// public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser { + public ConvertHitObjectParser(double offset, int formatVersion) + : base(offset, formatVersion) + { + } + protected override HitObject CreateHit(Vector2 position, bool newCombo) { return new ConvertHit diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs index 801e4ea449..ca94234afc 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs @@ -14,6 +14,11 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu /// public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser { + public ConvertHitObjectParser(double offset, int formatVersion) + : base(offset, formatVersion) + { + } + protected override HitObject CreateHit(Vector2 position, bool newCombo) { return new ConvertHit diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs index 03b1a3187a..20a9134dea 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs @@ -13,6 +13,11 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko /// public class ConvertHitObjectParser : Legacy.ConvertHitObjectParser { + public ConvertHitObjectParser(double offset, int formatVersion) + : base(offset, formatVersion) + { + } + protected override HitObject CreateHit(Vector2 position, bool newCombo) { return new ConvertHit From d2709613bc355d1158e577e650fdc1a3dec97d24 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 10:48:42 +0900 Subject: [PATCH 042/136] Add combo offset to ConvertHitObjectParser --- .../Legacy/Catch/ConvertHitObjectParser.cs | 8 +++--- .../Objects/Legacy/ConvertHitObjectParser.cs | 26 ++++++++++++------- .../Objects/Legacy/ConvertHitObjectType.cs | 2 +- .../Legacy/Mania/ConvertHitObjectParser.cs | 8 +++--- .../Legacy/Osu/ConvertHitObjectParser.cs | 8 +++--- .../Legacy/Taiko/ConvertHitObjectParser.cs | 8 +++--- 6 files changed, 34 insertions(+), 26 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs index 46be5ff3a5..35392cd237 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch { } - protected override HitObject CreateHit(Vector2 position, bool newCombo) + protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset) { return new ConvertHit { @@ -27,7 +27,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, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new ConvertSlider { @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch }; } - protected override HitObject CreateSpinner(Vector2 position, double endTime) + protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime) { return new ConvertSpinner { @@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch }; } - protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime) + protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime) { return null; } diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 4919aaea2b..77e5bd0e98 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -43,8 +43,11 @@ namespace osu.Game.Rulesets.Objects.Legacy Vector2 pos = new Vector2((int)Convert.ToSingle(split[0], CultureInfo.InvariantCulture), (int)Convert.ToSingle(split[1], CultureInfo.InvariantCulture)); - ConvertHitObjectType type = (ConvertHitObjectType)int.Parse(split[3]) & ~ConvertHitObjectType.ColourHax; + ConvertHitObjectType type = (ConvertHitObjectType)int.Parse(split[3]) & ~ConvertHitObjectType.ComboOffset; + bool combo = type.HasFlag(ConvertHitObjectType.NewCombo); + int comboOffset = (int)(type & ConvertHitObjectType.ComboOffset) >> 4; + type &= ~ConvertHitObjectType.NewCombo; var soundType = (LegacySoundType)int.Parse(split[4]); @@ -54,7 +57,7 @@ namespace osu.Game.Rulesets.Objects.Legacy if (type.HasFlag(ConvertHitObjectType.Circle)) { - result = CreateHit(pos, combo); + result = CreateHit(pos, combo, comboOffset); if (split.Length > 5) readCustomSampleBanks(split[5], bankInfo); @@ -159,11 +162,11 @@ namespace osu.Game.Rulesets.Objects.Legacy for (int i = 0; i < nodes; i++) nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i])); - result = CreateSlider(pos, combo, points, length, curveType, repeatCount, nodeSamples); + result = CreateSlider(pos, combo, comboOffset, points, length, curveType, repeatCount, nodeSamples); } else if (type.HasFlag(ConvertHitObjectType.Spinner)) { - result = CreateSpinner(new Vector2(512, 384) / 2, Convert.ToDouble(split[5], CultureInfo.InvariantCulture) + Offset); + result = CreateSpinner(new Vector2(512, 384) / 2, combo, comboOffset, Convert.ToDouble(split[5], CultureInfo.InvariantCulture) + Offset); if (split.Length > 6) readCustomSampleBanks(split[6], bankInfo); @@ -181,7 +184,7 @@ namespace osu.Game.Rulesets.Objects.Legacy readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo); } - result = CreateHold(pos, combo, endTime + Offset); + result = CreateHold(pos, combo, comboOffset, endTime + Offset); } if (result == null) @@ -232,37 +235,42 @@ namespace osu.Game.Rulesets.Objects.Legacy /// /// The position of the hit object. /// Whether the hit object creates a new combo. + /// When starting a new combo, the offset of the new combo relative to the current one. /// The hit object. - protected abstract HitObject CreateHit(Vector2 position, bool newCombo); + protected abstract HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset); /// /// Creats a legacy Slider-type hit object. /// /// The position of the hit object. /// Whether the hit object creates a new combo. + /// When starting a new combo, the offset of the new combo relative to the current one. /// The slider control points. /// The slider length. /// The slider curve type. /// 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, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples); /// /// Creates a legacy Spinner-type hit object. /// /// The position of the hit object. + /// Whether the hit object creates a new combo. + /// When starting a new combo, the offset of the new combo relative to the current one. /// The spinner end time. /// The hit object. - protected abstract HitObject CreateSpinner(Vector2 position, double endTime); + protected abstract HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime); /// /// Creates a legacy Hold-type hit object. /// /// The position of the hit object. /// Whether the hit object creates a new combo. + /// When starting a new combo, the offset of the new combo relative to the current one. /// The hold end time. - protected abstract HitObject CreateHold(Vector2 position, bool newCombo, double endTime); + protected abstract HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime); private List convertSoundType(LegacySoundType type, SampleBankInfo bankInfo) { diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs index c0626c3e56..fa47e56de7 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs @@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Objects.Legacy Slider = 1 << 1, NewCombo = 1 << 2, Spinner = 1 << 3, - ColourHax = 112, + ComboOffset = 1 << 4 | 1 << 5 | 1 << 6, Hold = 1 << 7 } } diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs index e4d4fc4687..ab6cfa3061 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania { } - protected override HitObject CreateHit(Vector2 position, bool newCombo) + protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset) { return new ConvertHit { @@ -27,7 +27,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, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new ConvertSlider { @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania }; } - protected override HitObject CreateSpinner(Vector2 position, double endTime) + protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime) { return new ConvertSpinner { @@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania }; } - protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime) + protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime) { return new ConvertHold { diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs index ca94234afc..7ef9865a96 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu { } - protected override HitObject CreateHit(Vector2 position, bool newCombo) + protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset) { return new ConvertHit { @@ -28,7 +28,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, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new ConvertSlider { @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu }; } - protected override HitObject CreateSpinner(Vector2 position, double endTime) + protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime) { return new ConvertSpinner { @@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu }; } - protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime) + protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime) { return null; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs index 20a9134dea..483e890392 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko { } - protected override HitObject CreateHit(Vector2 position, bool newCombo) + protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset) { return new ConvertHit { @@ -26,7 +26,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, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new ConvertSlider { @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko }; } - protected override HitObject CreateSpinner(Vector2 position, double endTime) + protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime) { return new ConvertSpinner { @@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko }; } - protected override HitObject CreateHold(Vector2 position, bool newCombo, double endTime) + protected override HitObject CreateHold(Vector2 position, bool newCombo, int comboOffset, double endTime) { return null; } From 8faf12579a0b6ec9ff54b1dcb5204c6a3be2c770 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 10:53:25 +0900 Subject: [PATCH 043/136] Fix field not being set correctly --- osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 77e5bd0e98..720ba5bbab 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -27,12 +27,12 @@ namespace osu.Game.Rulesets.Objects.Legacy /// /// The beatmap version. /// - public int FormatVersion = LegacyBeatmapDecoder.LATEST_VERSION; + public int FormatVersion; protected ConvertHitObjectParser(double offset, int formatVersion) { Offset = offset; - formatVersion = formatVersion; + FormatVersion = formatVersion; } public override HitObject Parse(string text) From 83f75ac8966c794329bf396474687653f1cd9a69 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 10:57:11 +0900 Subject: [PATCH 044/136] Mania convert hitobjects should not have combo --- osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs | 4 +--- .../Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs | 4 +--- osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs index ea4e7f6907..cbc8d2d4df 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs @@ -8,12 +8,10 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania /// /// Legacy osu!mania Hit-type, used for parsing Beatmaps. /// - internal sealed class ConvertHit : HitObject, IHasXPosition, IHasCombo + internal sealed class ConvertHit : HitObject, IHasXPosition { public float X { get; set; } - public bool NewCombo { get; set; } - protected override HitWindows CreateHitWindows() => null; } } diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs index ab6cfa3061..6f59965e18 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs @@ -22,8 +22,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania { return new ConvertHit { - X = position.X, - NewCombo = newCombo, + X = position.X }; } @@ -32,7 +31,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania return new ConvertSlider { X = position.X, - NewCombo = newCombo, ControlPoints = controlPoints, Distance = length, CurveType = curveType, diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs index a8d7b23df1..e1572889a3 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs @@ -8,12 +8,10 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania /// /// Legacy osu!mania Slider-type, used for parsing Beatmaps. /// - internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasXPosition, IHasCombo + internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasXPosition { public float X { get; set; } - public bool NewCombo { get; set; } - protected override HitWindows CreateHitWindows() => null; } } From 4f0305ffeb17abfee12c32f2a7465cefa73e34dc Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 10:58:59 +0900 Subject: [PATCH 045/136] Taiko convert hitobjects should not have combo --- osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs | 6 +----- .../Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs | 6 +----- osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs index 5e9786c84a..66e504bf22 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs @@ -1,17 +1,13 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Objects.Types; - namespace osu.Game.Rulesets.Objects.Legacy.Taiko { /// /// Legacy osu!taiko Hit-type, used for parsing Beatmaps. /// - internal sealed class ConvertHit : HitObject, IHasCombo + internal sealed class ConvertHit : HitObject { - public bool NewCombo { get; set; } - protected override HitWindows CreateHitWindows() => null; } } diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs index 483e890392..e5904825c2 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs @@ -20,17 +20,13 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset) { - return new ConvertHit - { - NewCombo = newCombo, - }; + return new ConvertHit(); } protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new ConvertSlider { - NewCombo = newCombo, ControlPoints = controlPoints, Distance = length, CurveType = curveType, diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs index 8a9a0db0a7..11c0a2baae 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs @@ -1,17 +1,13 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Objects.Types; - namespace osu.Game.Rulesets.Objects.Legacy.Taiko { /// /// Legacy osu!taiko Slider-type, used for parsing Beatmaps. /// - internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasCombo + internal sealed class ConvertSlider : Legacy.ConvertSlider { - public bool NewCombo { get; set; } - protected override HitWindows CreateHitWindows() => null; } } From da3e2cfee2a1684559ed3c5d66986c6b35cb2b6b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 11:04:31 +0900 Subject: [PATCH 046/136] Catch/osu! spinners should have combo --- osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs | 5 ++++- osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs | 5 +++-- osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs | 4 +++- osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs | 4 +++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index 68a8dfb7d3..15d4edc411 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -41,6 +41,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps RepeatCount = curveData.RepeatCount, X = (positionData?.X ?? 0) / CatchPlayfield.BASE_WIDTH, NewCombo = comboData?.NewCombo ?? false, + ComboOffset = comboData?.ComboOffset ?? 0, LegacyLastTickOffset = legacyOffset?.LegacyLastTickOffset ?? 0 }; } @@ -51,7 +52,8 @@ namespace osu.Game.Rulesets.Catch.Beatmaps StartTime = obj.StartTime, Samples = obj.Samples, Duration = endTime.Duration, - NewCombo = comboData?.NewCombo ?? false + NewCombo = comboData?.NewCombo ?? false, + ComboOffset = comboData?.ComboOffset ?? 0, }; } else @@ -61,6 +63,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps StartTime = obj.StartTime, Samples = obj.Samples, NewCombo = comboData?.NewCombo ?? false, + ComboOffset = comboData?.ComboOffset ?? 0, X = (positionData?.X ?? 0) / CatchPlayfield.BASE_WIDTH }; } diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs index 405493cde4..52ca7b7759 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -52,7 +52,8 @@ namespace osu.Game.Rulesets.Osu.Beatmaps StartTime = original.StartTime, Samples = original.Samples, EndTime = endTimeData.EndTime, - Position = positionData?.Position ?? OsuPlayfield.BASE_SIZE / 2 + Position = positionData?.Position ?? OsuPlayfield.BASE_SIZE / 2, + NewCombo = comboData?.NewCombo ?? false, }; } else @@ -62,7 +63,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps StartTime = original.StartTime, Samples = original.Samples, Position = positionData?.Position ?? Vector2.Zero, - NewCombo = comboData?.NewCombo ?? false + NewCombo = comboData?.NewCombo ?? false, }; } } diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs index 9dfe12f25e..9a160db799 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs @@ -8,10 +8,12 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch /// /// Legacy osu!catch Spinner-type, used for parsing Beatmaps. /// - internal sealed class ConvertSpinner : HitObject, IHasEndTime + internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasCombo { public double EndTime { get; set; } public double Duration => EndTime - StartTime; + + public bool NewCombo { get; set; } } } diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs index 0141785f31..f529c16306 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.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 ConvertSpinner : HitObject, IHasEndTime, IHasPosition + internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasPosition, IHasCombo { public double EndTime { get; set; } @@ -22,5 +22,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu public float Y => Position.Y; protected override HitWindows CreateHitWindows() => null; + + public bool NewCombo { get; set; } } } From 31f324945eea7292093c876270e33810dd4748c8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 11:47:31 +0900 Subject: [PATCH 047/136] Implement combo offsets --- osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs | 2 ++ osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs | 3 +++ osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHit.cs | 2 ++ .../Objects/Legacy/Catch/ConvertHitObjectParser.cs | 5 ++++- .../Rulesets/Objects/Legacy/Catch/ConvertSlider.cs | 2 ++ .../Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs | 2 ++ .../Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 11 ++++++----- osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs | 2 ++ .../Objects/Legacy/Osu/ConvertHitObjectParser.cs | 5 ++++- osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs | 2 ++ .../Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs | 2 ++ osu.Game/Rulesets/Objects/Types/IHasCombo.cs | 5 +++++ 13 files changed, 38 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index d55cdac115..621fc100c2 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -20,6 +20,8 @@ namespace osu.Game.Rulesets.Catch.Objects public virtual bool NewCombo { get; set; } + public int ComboOffset { get; set; } + public int IndexInCurrentCombo { get; set; } public int ComboIndex { get; set; } diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs index 52ca7b7759..93f3f06dc2 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -42,6 +42,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps RepeatCount = curveData.RepeatCount, Position = positionData?.Position ?? Vector2.Zero, NewCombo = comboData?.NewCombo ?? false, + ComboOffset = comboData?.ComboOffset ?? 0, LegacyLastTickOffset = legacyOffset?.LegacyLastTickOffset }; } @@ -54,6 +55,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps EndTime = endTimeData.EndTime, Position = positionData?.Position ?? OsuPlayfield.BASE_SIZE / 2, NewCombo = comboData?.NewCombo ?? false, + ComboOffset = comboData?.ComboOffset ?? 0, }; } else @@ -64,6 +66,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps Samples = original.Samples, Position = positionData?.Position ?? Vector2.Zero, NewCombo = comboData?.NewCombo ?? false, + ComboOffset = comboData?.ComboOffset ?? 0, }; } } diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index 48a6365c00..fdf5aaffa8 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -54,6 +54,8 @@ namespace osu.Game.Rulesets.Osu.Objects public virtual bool NewCombo { get; set; } + public int ComboOffset { get; set; } + public virtual int IndexInCurrentCombo { get; set; } public virtual int ComboIndex { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHit.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHit.cs index 50035ea116..0573a08361 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHit.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHit.cs @@ -13,5 +13,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch public float X { get; set; } public bool NewCombo { get; set; } + + public int ComboOffset { get; set; } } } diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs index 35392cd237..ac97037d55 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs @@ -24,6 +24,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch { X = position.X, NewCombo = newCombo, + ComboOffset = comboOffset }; } @@ -33,6 +34,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch { X = position.X, NewCombo = newCombo, + ComboOffset = comboOffset, ControlPoints = controlPoints, Distance = length, CurveType = curveType, @@ -45,7 +47,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch { return new ConvertSpinner { - EndTime = endTime + EndTime = endTime, + ComboOffset = comboOffset }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSlider.cs index 73e277a125..a187caaa26 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSlider.cs @@ -13,5 +13,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch public float X { get; set; } public bool NewCombo { get; set; } + + public int ComboOffset { get; set; } } } diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs index 9a160db799..db79ca60f1 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs @@ -15,5 +15,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch public double Duration => EndTime - StartTime; public bool NewCombo { get; set; } + + public int ComboOffset { get; set; } } } diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 720ba5bbab..f9ca0545a1 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -22,12 +22,12 @@ namespace osu.Game.Rulesets.Objects.Legacy /// /// The offset to apply to all time values. /// - public double Offset; + protected readonly double Offset; /// /// The beatmap version. /// - public int FormatVersion; + protected readonly int FormatVersion; protected ConvertHitObjectParser(double offset, int formatVersion) { @@ -43,11 +43,12 @@ namespace osu.Game.Rulesets.Objects.Legacy Vector2 pos = new Vector2((int)Convert.ToSingle(split[0], CultureInfo.InvariantCulture), (int)Convert.ToSingle(split[1], CultureInfo.InvariantCulture)); - ConvertHitObjectType type = (ConvertHitObjectType)int.Parse(split[3]) & ~ConvertHitObjectType.ComboOffset; + ConvertHitObjectType type = (ConvertHitObjectType)int.Parse(split[3]); + + int comboOffset = (int)(type & ConvertHitObjectType.ComboOffset) >> 4; + type &= ~ConvertHitObjectType.ComboOffset; bool combo = type.HasFlag(ConvertHitObjectType.NewCombo); - int comboOffset = (int)(type & ConvertHitObjectType.ComboOffset) >> 4; - type &= ~ConvertHitObjectType.NewCombo; var soundType = (LegacySoundType)int.Parse(split[4]); diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs index f015272b2c..0062e83a28 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs @@ -19,6 +19,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu public bool NewCombo { get; set; } + public int ComboOffset { get; set; } + protected override HitWindows CreateHitWindows() => null; } } diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs index 7ef9865a96..9b0554c395 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs @@ -25,6 +25,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu { Position = position, NewCombo = newCombo, + ComboOffset = comboOffset }; } @@ -34,6 +35,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu { Position = position, NewCombo = newCombo, + ComboOffset = comboOffset, ControlPoints = controlPoints, Distance = Math.Max(0, length), CurveType = curveType, @@ -47,7 +49,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu return new ConvertSpinner { Position = position, - EndTime = endTime + EndTime = endTime, + ComboOffset = comboOffset }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs index ec5a002bbb..45f7bc9e67 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs @@ -19,6 +19,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu public bool NewCombo { get; set; } + public int ComboOffset { get; set; } + protected override HitWindows CreateHitWindows() => null; } } diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs index f529c16306..3b349d9704 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs @@ -24,5 +24,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu protected override HitWindows CreateHitWindows() => null; public bool NewCombo { get; set; } + + public int ComboOffset { get; set; } } } diff --git a/osu.Game/Rulesets/Objects/Types/IHasCombo.cs b/osu.Game/Rulesets/Objects/Types/IHasCombo.cs index cb8b6f495a..95f1a1cb3d 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasCombo.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasCombo.cs @@ -12,5 +12,10 @@ namespace osu.Game.Rulesets.Objects.Types /// Whether the HitObject starts a new combo. /// bool NewCombo { get; } + + /// + /// When starting a new combo, the offset of the new combo relative to the current one. + /// + int ComboOffset { get; } } } From 4c3e551295e12ef626ba2ec4be8205f4eecbd045 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 11:47:54 +0900 Subject: [PATCH 048/136] Fix first object not receiving new combo Note: If a normal catch fruit is the first object, it does not receive a new combo... --- .../Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs | 3 ++- osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 4 ++++ .../Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs | 5 +++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs index ac97037d55..fb4cde479b 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch return new ConvertSlider { X = position.X, - NewCombo = newCombo, + NewCombo = FirstObject || newCombo, ComboOffset = comboOffset, ControlPoints = controlPoints, Distance = length, @@ -48,6 +48,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch return new ConvertSpinner { EndTime = endTime, + NewCombo = FirstObject || newCombo, ComboOffset = comboOffset }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index f9ca0545a1..8236333a3f 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -29,6 +29,8 @@ namespace osu.Game.Rulesets.Objects.Legacy /// protected readonly int FormatVersion; + protected bool FirstObject { get; private set; } = true; + protected ConvertHitObjectParser(double offset, int formatVersion) { Offset = offset; @@ -194,6 +196,8 @@ namespace osu.Game.Rulesets.Objects.Legacy result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture) + Offset; result.Samples = convertSoundType(soundType, bankInfo); + FirstObject = false; + return result; } catch (FormatException) diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs index 9b0554c395..0823653830 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu return new ConvertHit { Position = position, - NewCombo = newCombo, + NewCombo = FirstObject || newCombo, ComboOffset = comboOffset }; } @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu return new ConvertSlider { Position = position, - NewCombo = newCombo, + NewCombo = FirstObject || newCombo, ComboOffset = comboOffset, ControlPoints = controlPoints, Distance = Math.Max(0, length), @@ -50,6 +50,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu { Position = position, EndTime = endTime, + NewCombo = FormatVersion <= 8 || FirstObject || newCombo, ComboOffset = comboOffset }; } From 539dd3134f383bf5eb0bcf7588819ab5fafc883d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 11:48:50 +0900 Subject: [PATCH 049/136] Fix beatmap processor not setting combo index on first object --- osu.Game/Beatmaps/BeatmapProcessor.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 0173125e8b..9d7cd673dc 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -27,11 +27,10 @@ namespace osu.Game.Beatmaps if (obj.NewCombo) { obj.IndexInCurrentCombo = 0; + obj.ComboIndex = (lastObj?.ComboIndex ?? 0) + obj.ComboOffset + 1; + if (lastObj != null) - { lastObj.LastInCombo = true; - obj.ComboIndex = lastObj.ComboIndex + 1; - } } else if (lastObj != null) { From 05b5144dac62bcb78f526dffb9504eceda95005c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 13:36:22 +0900 Subject: [PATCH 050/136] Add parsing test --- .../Beatmaps/Formats/LegacyBeatmapDecoderTest.cs | 12 ++++++++++++ osu.Game.Tests/Resources/hitobject-combo-offset.osu | 4 ++++ 2 files changed, 16 insertions(+) create mode 100644 osu.Game.Tests/Resources/hitobject-combo-offset.osu diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index 400380b407..0a5df0e093 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -186,6 +186,18 @@ namespace osu.Game.Tests.Beatmaps.Formats } } + [Test] + public void TestDecodeBeatmapComboOffsets() + { + var decoder = new LegacyBeatmapDecoder(); + using (var resStream = Resource.OpenResource("hitobject-combo-offset.osu")) + using (var stream = new StreamReader(resStream)) + { + var beatmap = decoder.Decode(stream); + Assert.AreEqual(3, ((IHasCombo)beatmap.HitObjects[0]).ComboOffset); + } + } + [Test] public void TestDecodeBeatmapHitObjects() { diff --git a/osu.Game.Tests/Resources/hitobject-combo-offset.osu b/osu.Game.Tests/Resources/hitobject-combo-offset.osu new file mode 100644 index 0000000000..4a44d31e22 --- /dev/null +++ b/osu.Game.Tests/Resources/hitobject-combo-offset.osu @@ -0,0 +1,4 @@ +osu file format v14 + +[HitObjects] +255,193,2170,49,0,0:0:0:0: \ No newline at end of file From 4dfb63023fecb6ee694d4a0972acb1957c5d0809 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 15:49:48 +0900 Subject: [PATCH 051/136] Update with recent changes --- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- osu.Game/osu.Game.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 0ff6c3d98c..1c28b533d2 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -329,7 +329,7 @@ namespace osu.Game.Beatmaps return; } - await Task.Factory.StartNew(() => Import(stable.GetDirectories("Songs").Select(stable.GetUsablePathFor).ToArray()), TaskCreationOptions.LongRunning); + await Task.Factory.StartNew(() => Import(stable.GetDirectories("Songs").Select(f => stable.GetFullPath(f)).ToArray()), TaskCreationOptions.LongRunning); } /// diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index e9fc51ee9b..804d6587e8 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 767c284793884011e511266083660bdc588146b1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 15:49:55 +0900 Subject: [PATCH 052/136] Fix import not working --- osu.Game/Database/ArchiveModelManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 0465c0ad73..c00df59e3e 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -412,7 +412,7 @@ namespace osu.Game.Database private ArchiveReader getReaderFrom(string path) { if (ZipUtils.IsZipArchive(path)) - return new ZipArchiveReader(Files.Storage.GetStream(path), Path.GetFileName(path)); + return new ZipArchiveReader(File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read), Path.GetFileName(path)); if (Directory.Exists(path)) return new LegacyFilesystemReader(path); throw new InvalidFormatException($"{path} is not a valid archive"); From add78508e09efc3a34224f26b68d84e75466269b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 15:54:26 +0900 Subject: [PATCH 053/136] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 804d6587e8..eef586fd4c 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From fe99aab0f20b7a6987bcdd9a9ea3f591c5c81e3f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 16:45:33 +0900 Subject: [PATCH 054/136] Remove highly unnecessary testcase --- .../TestCaseEditorSetupCircularButton.cs | 45 ------------------- 1 file changed, 45 deletions(-) delete mode 100644 osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs diff --git a/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs b/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs deleted file mode 100644 index c6037b706b..0000000000 --- a/osu.Game.Tests/Visual/TestCaseEditorSetupCircularButton.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics; -using osu.Framework.Allocation; -using osu.Framework.Graphics.Containers; -using osu.Game.Screens.Edit.Screens.Setup.Components; -using OpenTK; - -namespace osu.Game.Tests.Visual -{ - public class TestCaseEditorSetupCircularButton : OsuTestCase - { - [BackgroundDependencyLoader] - private void load() - { - Child = new FillFlowContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Children = new[] - { - new SetupCircularButton { Text = "Default" }, - new SetupCircularButton - { - Width = 200, - Text = "Wide", - }, - new SetupCircularButton - { - Height = 100, - Text = "High" - }, - new SetupCircularButton - { - Size = new Vector2(200, 100), - Text = "Wide 'n' High" - } - } - }; - } - } -} From 85dc42d47a9e4085eb51aed85f77fe4bd69b8ae1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 15 Aug 2018 16:47:20 +0900 Subject: [PATCH 055/136] Re-namespace/rename CircularButton --- .../CircularButton.cs} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename osu.Game/Screens/Edit/{Screens/Setup/Components/SetupCircularButton.cs => Components/CircularButton.cs} (78%) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs b/osu.Game/Screens/Edit/Components/CircularButton.cs similarity index 78% rename from osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs rename to osu.Game/Screens/Edit/Components/CircularButton.cs index d46fb2f269..a8ad242772 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupCircularButton.cs +++ b/osu.Game/Screens/Edit/Components/CircularButton.cs @@ -1,17 +1,17 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; using osu.Game.Graphics.UserInterface; +using OpenTK; -namespace osu.Game.Screens.Edit.Screens.Setup.Components +namespace osu.Game.Screens.Edit.Components { - public class SetupCircularButton : OsuButton + public class CircularButton : OsuButton { private const float width = 125; private const float height = 30; - public SetupCircularButton() + public CircularButton() { Size = new Vector2(width, height); } From ed2a642666111e05f3af952198832cc64449d315 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Aug 2018 09:59:03 +0900 Subject: [PATCH 056/136] Fix info wedge test case failing randomly --- .../Visual/TestCaseBeatmapInfoWedge.cs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index b232180eba..175db7d246 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; +using JetBrains.Annotations; using NUnit.Framework; using OpenTK; using osu.Framework.Allocation; @@ -116,7 +117,7 @@ namespace osu.Game.Tests.Visual private void testNullBeatmap() { - selectNullBeatmap(); + selectBeatmap(null); AddAssert("check empty version", () => string.IsNullOrEmpty(infoWedge.Info.VersionLabel.Text)); AddAssert("check default title", () => infoWedge.Info.TitleLabel.Text == Beatmap.Default.BeatmapInfo.Metadata.Title); AddAssert("check default artist", () => infoWedge.Info.ArtistLabel.Text == Beatmap.Default.BeatmapInfo.Metadata.Artist); @@ -124,28 +125,19 @@ namespace osu.Game.Tests.Visual AddAssert("check no info labels", () => !infoWedge.Info.InfoLabelContainer.Children.Any()); } - private void selectBeatmap(IBeatmap b) + private void selectBeatmap([CanBeNull] IBeatmap b) { BeatmapInfoWedge.BufferedWedgeInfo infoBefore = null; - AddStep($"select {b.Metadata.Title} beatmap", () => + AddStep($"select {b?.Metadata.Title ?? "null"} beatmap", () => { infoBefore = infoWedge.Info; - infoWedge.Beatmap = Beatmap.Value = new TestWorkingBeatmap(b); + infoWedge.Beatmap = Beatmap.Value = b == null ? Beatmap.Default : new TestWorkingBeatmap(b); }); AddUntilStep(() => infoWedge.Info != infoBefore, "wait for async load"); } - private void selectNullBeatmap() - { - AddStep("select null beatmap", () => - { - Beatmap.Value = Beatmap.Default; - infoWedge.Beatmap = Beatmap; - }); - } - private IBeatmap createTestBeatmap(RulesetInfo ruleset) { List objects = new List(); From 74a79bfcfa816f089a5423682a180fb3310db967 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 16 Aug 2018 10:45:06 +0900 Subject: [PATCH 057/136] Fix hold note head/tails not being nested hitobjects --- osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index e493956d6e..77562bb4c2 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -70,9 +70,6 @@ namespace osu.Game.Rulesets.Mania.Objects TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime); tickSpacing = timingPoint.BeatLength / difficulty.SliderTickRate; - - Head.ApplyDefaults(controlPointInfo, difficulty); - Tail.ApplyDefaults(controlPointInfo, difficulty); } protected override void CreateNestedHitObjects() @@ -80,6 +77,9 @@ namespace osu.Game.Rulesets.Mania.Objects base.CreateNestedHitObjects(); createTicks(); + + AddNested(Head); + AddNested(Tail); } private void createTicks() From b26c8e3b9e85c09c908332c52704aa552a2170e3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Aug 2018 14:02:49 +0900 Subject: [PATCH 058/136] Fix notifiation stack trace output on mania conversion failure --- .../Beatmaps/Patterns/PatternGenerator.cs | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs index 3434c9f01e..1f416f921e 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs @@ -55,15 +55,18 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns { int iterations = 0; - while (condition() && iterations++ < max_rng_iterations) + while (condition()) + { + if (iterations++ >= max_rng_iterations) + { + // log an error but don't throw. we want to continue execution. + Logger.Error(new ExceededAllowedIterationsException(new StackTrace(0)), + "Conversion encountered errors. The beatmap may not be correctly converted."); + return; + } + action(); - - if (iterations < max_rng_iterations) - return; - - // Generate + log an error/stacktrace - - Logger.Log($"Allowable iterations ({max_rng_iterations}) exceeded:\n{new StackTrace(0)}", level: LogLevel.Error); + } } /// @@ -71,5 +74,20 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns /// /// The s containing the hit objects. public abstract IEnumerable Generate(); + + /// + /// Denotes when a single conversion operation is in an infinitely looping state. + /// + public class ExceededAllowedIterationsException : Exception + { + private readonly string stackTrace; + + public ExceededAllowedIterationsException(StackTrace stackTrace) + { + this.stackTrace = stackTrace.ToString(); + } + + public override string StackTrace => stackTrace; + } } } From 562a31713e04f23f23d1596bf74b09dad658c16b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Aug 2018 16:44:04 +0900 Subject: [PATCH 059/136] Fix regression in handling logic --- osu.Desktop/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 4574fb6fc9..19ceade644 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -65,7 +65,7 @@ namespace osu.Desktop Logger.Log($"Unhandled exception has been {(continueExecution ? "allowed" : "denied")} with {allowableExceptions} more allowable exceptions."); Task.Delay(1000).ContinueWith(_ => Interlocked.Increment(ref allowableExceptions)); - return Interlocked.Decrement(ref allowableExceptions) >= 0; + return continueExecution; } } } From 9f55afe5692a91368df55f37e279630ceb5b78b2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Aug 2018 16:44:12 +0900 Subject: [PATCH 060/136] Let user know automatic reporting happened --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 189a51dec9..6576529326 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -463,7 +463,7 @@ namespace osu.Game Schedule(() => notifications.Post(new SimpleNotification { Icon = entry.Level == LogLevel.Important ? FontAwesome.fa_exclamation_circle : FontAwesome.fa_bomb, - Text = entry.Message, + Text = entry.Message + (entry.Exception != null ? "\n\nThis error has been automatically reported to the devs." : string.Empty), })); } else if (recentLogCount == short_term_display_limit) From 6297ad95aa49c133c860f59d7c6cbeabbc9ad1eb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Aug 2018 16:44:18 +0900 Subject: [PATCH 061/136] Remove test exception --- osu.Game/Screens/Select/PlaySongSelect.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index e83097637d..e914eb365e 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 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 System.Threading.Tasks; @@ -143,8 +142,6 @@ namespace osu.Game.Screens.Select { if (player != null) return false; - throw new Exception("this is a test!"); - // Ctrl+Enter should start map with autoplay enabled. if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true) { From 870f6bea47cb9f563ffe8d7424c7cd864de6e0d6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Aug 2018 18:18:08 +0900 Subject: [PATCH 062/136] Only process alive objects --- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index f0e7891a96..744b313f70 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Mods const float relax_leniency = 3; - foreach (var drawable in playfield.HitObjects.Objects) + foreach (var drawable in playfield.HitObjects.AliveObjects) { if (!(drawable is DrawableOsuHitObject osuHit)) continue; From bc22a28fef7c1e773ba7b681559545ace37cdb7b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Aug 2018 18:18:15 +0900 Subject: [PATCH 063/136] Clean up logic and variables --- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 44 ++++++++++++++--------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index 744b313f70..4e0c12f619 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -7,13 +7,14 @@ using System.Linq; using osu.Framework.Input.States; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.UI; using static osu.Game.Input.Handlers.ReplayInputHandler; namespace osu.Game.Rulesets.Osu.Mods { - public class OsuModRelax : ModRelax, IApplicableFailOverride, IUpdatableByPlayfield + public class OsuModRelax : ModRelax, IApplicableFailOverride, IUpdatableByPlayfield, IApplicableToRulesetContainer { public override string Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things."; public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).ToArray(); @@ -22,8 +23,8 @@ namespace osu.Game.Rulesets.Osu.Mods public void Update(Playfield playfield) { - bool hitStill = false; - bool hitOnce = false; + bool requiresHold = false; + bool requiresHit = false; const float relax_leniency = 3; @@ -35,45 +36,54 @@ namespace osu.Game.Rulesets.Osu.Mods double time = osuHit.Clock.CurrentTime; double relativetime = time - osuHit.HitObject.StartTime; - if (osuHit.IsAlive && time >= osuHit.HitObject.StartTime - relax_leniency) - { - if (osuHit.HitObject is IHasEndTime hasEnd && time > hasEnd.EndTime || osuHit.IsHit) - continue; + if (time < osuHit.HitObject.StartTime - relax_leniency) continue; - hitStill |= osuHit is DrawableSlider slider && (slider.Ball.IsHovered || osuHit.IsHovered) || osuHit is DrawableSpinner; + if (osuHit.HitObject is IHasEndTime hasEnd && time > hasEnd.EndTime || osuHit.IsHit) + continue; - hitOnce |= osuHit is DrawableHitCircle && osuHit.IsHovered && osuHit.HitObject.HitWindows.CanBeHit(relativetime); - } + requiresHit |= osuHit is DrawableHitCircle && osuHit.IsHovered && osuHit.HitObject.HitWindows.CanBeHit(relativetime); + requiresHold |= osuHit is DrawableSlider slider && (slider.Ball.IsHovered || osuHit.IsHovered) || osuHit is DrawableSpinner; } - var osuHitSample = playfield.HitObjects.Objects.First(d => d is DrawableOsuHitObject) as DrawableOsuHitObject; - if (hitOnce) + if (requiresHit) { - hit(osuHitSample, false); - hit(osuHitSample, true); + addAction(false); + addAction(true); } - hit(osuHitSample, hitStill); + + addAction(requiresHold); } private bool wasHit; private bool wasLeft; - private void hit(DrawableOsuHitObject osuHit, bool hitting) + private OsuInputManager osuInputManager; + + private void addAction(bool hitting) { if (wasHit == hitting) return; + wasHit = hitting; var state = new ReplayState { PressedActions = new List() }; + if (hitting) { state.PressedActions.Add(wasLeft ? OsuAction.LeftButton : OsuAction.RightButton); wasLeft = !wasLeft; } - osuHit.OsuActionInputManager.HandleCustomInput(new InputState(), state); + + osuInputManager.HandleCustomInput(new InputState(), state); + } + + public void ApplyToRulesetContainer(RulesetContainer rulesetContainer) + { + // grab the input manager for future use. + osuInputManager = (OsuInputManager)rulesetContainer.KeyBindingInputManager; } } } From dfecb3235b7d3d0bbf0d694f1528071aa87e61b0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Aug 2018 20:41:53 +0900 Subject: [PATCH 064/136] Fix custom exception stack trace output --- osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs index 1f416f921e..1eb0cdae2f 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs @@ -88,6 +88,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns } public override string StackTrace => stackTrace; + public override string ToString() => $"{GetType().Name}: {Message}\r\n{StackTrace}"; } } } From 12b81df2f39855a916b6ce9d151724361e175872 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Aug 2018 22:01:04 +0900 Subject: [PATCH 065/136] Fix unhandled exception on startup when arguments are present --- osu.Game/OsuGame.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 6576529326..ecf5500ca4 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -151,9 +151,9 @@ namespace osu.Game if (args?.Length > 0) { - var paths = args.Where(a => !a.StartsWith(@"-")); - - Task.Run(() => Import(paths.ToArray())); + var paths = args.Where(a => !a.StartsWith(@"-")).ToArray(); + if (paths.Length > 0) + Task.Run(() => Import(paths)); } dependencies.CacheAs(this); From 9f5a6457f26be725988c1e29d9641a24d7c69b07 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 Aug 2018 09:08:58 +0900 Subject: [PATCH 066/136] Don't forward errors to sentry for local builds --- osu.Game/Utils/RavenLogger.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Utils/RavenLogger.cs b/osu.Game/Utils/RavenLogger.cs index aadb70add8..761bd51672 100644 --- a/osu.Game/Utils/RavenLogger.cs +++ b/osu.Game/Utils/RavenLogger.cs @@ -23,6 +23,8 @@ namespace osu.Game.Utils { raven.Release = game.Version; + if (!game.IsDeployedBuild) return; + Logger.NewEntry += entry => { if (entry.Level < LogLevel.Verbose) return; From eb6f1ae72cda9baa2dc4b903724932a511163743 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 17 Aug 2018 09:16:28 +0900 Subject: [PATCH 067/136] Fix spinners providing one extra combo --- osu.Game.Rulesets.Osu/Objects/Spinner.cs | 2 -- .../Legacy/Catch/ConvertHitObjectParser.cs | 22 ++++++++++++++++--- .../Legacy/Osu/ConvertHitObjectParser.cs | 22 ++++++++++++++++--- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index e1a7a7c6df..1c60fd4831 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -20,8 +20,6 @@ namespace osu.Game.Rulesets.Osu.Objects /// public int SpinsRequired { get; protected set; } = 1; - public override bool NewCombo => true; - protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) { base.ApplyDefaultsToSelf(controlPointInfo, difficulty); diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs index fb4cde479b..cb44fb1c8c 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs @@ -18,8 +18,17 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch { } + private bool forceNewCombo; + private int extraComboOffset; + protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset) { + newCombo |= forceNewCombo; + comboOffset += extraComboOffset; + + forceNewCombo = false; + extraComboOffset = 0; + return new ConvertHit { X = position.X, @@ -30,6 +39,12 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { + newCombo |= forceNewCombo; + comboOffset += extraComboOffset; + + forceNewCombo = false; + extraComboOffset = 0; + return new ConvertSlider { X = position.X, @@ -45,11 +60,12 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime) { + forceNewCombo |= FormatVersion <= 8 || newCombo; + extraComboOffset += comboOffset; + return new ConvertSpinner { - EndTime = endTime, - NewCombo = FirstObject || newCombo, - ComboOffset = comboOffset + EndTime = endTime }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs index 0823653830..497d85f849 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs @@ -19,8 +19,17 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu { } + private bool forceNewCombo; + private int extraComboOffset; + protected override HitObject CreateHit(Vector2 position, bool newCombo, int comboOffset) { + newCombo |= forceNewCombo; + comboOffset += extraComboOffset; + + forceNewCombo = false; + extraComboOffset = 0; + return new ConvertHit { Position = position, @@ -31,6 +40,12 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { + newCombo |= forceNewCombo; + comboOffset += extraComboOffset; + + forceNewCombo = false; + extraComboOffset = 0; + return new ConvertSlider { Position = position, @@ -46,12 +61,13 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime) { + forceNewCombo |= FormatVersion <= 8 || newCombo; + extraComboOffset += comboOffset; + return new ConvertSpinner { Position = position, - EndTime = endTime, - NewCombo = FormatVersion <= 8 || FirstObject || newCombo, - ComboOffset = comboOffset + EndTime = endTime }; } From 557a2ee39d42937b5f0501ae147a86da66e45dc3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 17 Aug 2018 10:04:00 +0900 Subject: [PATCH 068/136] Add more comprehensive tests --- .../Beatmaps/OsuBeatmapConverter.cs | 2 +- .../Beatmaps/OsuBeatmapProcessor.cs | 2 +- .../Formats/LegacyBeatmapDecoderTest.cs | 38 ++++++++++++++++++- .../Resources/hitobject-combo-offset.osu | 30 ++++++++++++++- 4 files changed, 67 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs index 93f3f06dc2..9e0e649eb2 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -12,7 +12,7 @@ using osu.Game.Rulesets.Osu.UI; namespace osu.Game.Rulesets.Osu.Beatmaps { - internal class OsuBeatmapConverter : BeatmapConverter + public class OsuBeatmapConverter : BeatmapConverter { public OsuBeatmapConverter(IBeatmap beatmap) : base(beatmap) diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs index bbe2d67baa..5fe2457645 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs @@ -8,7 +8,7 @@ using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Beatmaps { - internal class OsuBeatmapProcessor : BeatmapProcessor + public class OsuBeatmapProcessor : BeatmapProcessor { public OsuBeatmapProcessor(IBeatmap beatmap) : base(beatmap) diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index 0a5df0e093..d3351f86f8 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -11,7 +11,9 @@ using osu.Game.Audio; using osu.Game.Rulesets.Objects.Types; using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.Timing; +using osu.Game.Rulesets.Catch.Beatmaps; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu.Beatmaps; using osu.Game.Skinning; namespace osu.Game.Tests.Beatmaps.Formats @@ -187,14 +189,46 @@ namespace osu.Game.Tests.Beatmaps.Formats } [Test] - public void TestDecodeBeatmapComboOffsets() + public void TestDecodeBeatmapComboOffsetsOsu() { var decoder = new LegacyBeatmapDecoder(); using (var resStream = Resource.OpenResource("hitobject-combo-offset.osu")) using (var stream = new StreamReader(resStream)) { var beatmap = decoder.Decode(stream); - Assert.AreEqual(3, ((IHasCombo)beatmap.HitObjects[0]).ComboOffset); + + var converted = new OsuBeatmapConverter(beatmap).Convert(); + new OsuBeatmapProcessor(converted).PreProcess(); + new OsuBeatmapProcessor(converted).PostProcess(); + + Assert.AreEqual(4, ((IHasComboInformation)converted.HitObjects.ElementAt(0)).ComboIndex); + Assert.AreEqual(5, ((IHasComboInformation)converted.HitObjects.ElementAt(2)).ComboIndex); + Assert.AreEqual(5, ((IHasComboInformation)converted.HitObjects.ElementAt(4)).ComboIndex); + Assert.AreEqual(6, ((IHasComboInformation)converted.HitObjects.ElementAt(6)).ComboIndex); + Assert.AreEqual(11, ((IHasComboInformation)converted.HitObjects.ElementAt(8)).ComboIndex); + Assert.AreEqual(14, ((IHasComboInformation)converted.HitObjects.ElementAt(11)).ComboIndex); + } + } + + [Test] + public void TestDecodeBeatmapComboOffsetsCatch() + { + var decoder = new LegacyBeatmapDecoder(); + using (var resStream = Resource.OpenResource("hitobject-combo-offset.osu")) + using (var stream = new StreamReader(resStream)) + { + var beatmap = decoder.Decode(stream); + + var converted = new CatchBeatmapConverter(beatmap).Convert(); + new CatchBeatmapProcessor(converted).PreProcess(); + new CatchBeatmapProcessor(converted).PostProcess(); + + Assert.AreEqual(4, ((IHasComboInformation)converted.HitObjects.ElementAt(0)).ComboIndex); + Assert.AreEqual(5, ((IHasComboInformation)converted.HitObjects.ElementAt(2)).ComboIndex); + Assert.AreEqual(5, ((IHasComboInformation)converted.HitObjects.ElementAt(4)).ComboIndex); + Assert.AreEqual(6, ((IHasComboInformation)converted.HitObjects.ElementAt(6)).ComboIndex); + Assert.AreEqual(11, ((IHasComboInformation)converted.HitObjects.ElementAt(8)).ComboIndex); + Assert.AreEqual(14, ((IHasComboInformation)converted.HitObjects.ElementAt(11)).ComboIndex); } } diff --git a/osu.Game.Tests/Resources/hitobject-combo-offset.osu b/osu.Game.Tests/Resources/hitobject-combo-offset.osu index 4a44d31e22..c1f0dab8e9 100644 --- a/osu.Game.Tests/Resources/hitobject-combo-offset.osu +++ b/osu.Game.Tests/Resources/hitobject-combo-offset.osu @@ -1,4 +1,32 @@ osu file format v14 [HitObjects] -255,193,2170,49,0,0:0:0:0: \ No newline at end of file +// Circle with combo offset (3) +255,193,1000,49,0,0:0:0:0: +// Combo index = 4 + +// Slider with new combo followed by circle with no new combo +256,192,2000,12,0,2000,0:0:0:0: +255,193,3000,1,0,0:0:0:0: +// Combo index = 5 + +// Slider without new combo followed by circle with no new combo +256,192,4000,8,0,5000,0:0:0:0: +255,193,6000,1,0,0:0:0:0: +// Combo index = 5 + +// Slider without new combo followed by circle with new combo +256,192,7000,8,0,8000,0:0:0:0: +255,193,9000,5,0,0:0:0:0: +// Combo index = 6 + +// Slider with new combo and offset (1) followed by circle with new combo and offset (3) +256,192,10000,28,0,11000,0:0:0:0: +255,193,12000,53,0,0:0:0:0: +// Combo index = 11 + +// Slider with new combo and offset (2) followed by slider with no new combo followed by circle with no new combo +256,192,13000,44,0,14000,0:0:0:0: +256,192,15000,8,0,16000,0:0:0:0: +255,193,17000,1,0,0:0:0:0: +// Combo index = 14 \ No newline at end of file From 83dc01d07c9d61523e294d1affa9763c448b96b5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 Aug 2018 12:03:31 +0900 Subject: [PATCH 069/136] Fix multiple sentry reports arriving for similar exceptions --- osu.Desktop/Program.cs | 4 +++- osu.Game/Utils/RavenLogger.cs | 20 ++++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 19ceade644..db77427f96 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -62,9 +62,11 @@ namespace osu.Desktop { bool continueExecution = Interlocked.Decrement(ref allowableExceptions) >= 0; - Logger.Log($"Unhandled exception has been {(continueExecution ? "allowed" : "denied")} with {allowableExceptions} more allowable exceptions."); + Logger.Log($"Unhandled exception has been {(continueExecution ? "allowed with {allowableExceptions} more allowable exceptions" : "denied")} ."); + // restore the stock of allowable exceptions after a short delay. Task.Delay(1000).ContinueWith(_ => Interlocked.Increment(ref allowableExceptions)); + return continueExecution; } } diff --git a/osu.Game/Utils/RavenLogger.cs b/osu.Game/Utils/RavenLogger.cs index 761bd51672..70080fefa8 100644 --- a/osu.Game/Utils/RavenLogger.cs +++ b/osu.Game/Utils/RavenLogger.cs @@ -19,18 +19,30 @@ namespace osu.Game.Utils private readonly List tasks = new List(); + private Exception lastException; + public RavenLogger(OsuGame game) { raven.Release = game.Version; - if (!game.IsDeployedBuild) return; - Logger.NewEntry += entry => { if (entry.Level < LogLevel.Verbose) return; - if (entry.Exception != null) - queuePendingTask(raven.CaptureAsync(new SentryEvent(entry.Exception))); + var exception = entry.Exception; + + if (exception != null) + { + // since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports. + if (lastException != null && + lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace)) + { + return; + } + + lastException = exception; + queuePendingTask(raven.CaptureAsync(new SentryEvent(exception))); + } else raven.AddTrail(new Breadcrumb(entry.Target.ToString(), BreadcrumbType.Navigation) { Message = entry.Message }); }; From 0ae487b9c9a478afff2e083a07475a2da44932c1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 Aug 2018 12:27:36 +0900 Subject: [PATCH 070/136] Add back missing statement --- osu.Game/Utils/RavenLogger.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Utils/RavenLogger.cs b/osu.Game/Utils/RavenLogger.cs index 70080fefa8..b28dd1fb73 100644 --- a/osu.Game/Utils/RavenLogger.cs +++ b/osu.Game/Utils/RavenLogger.cs @@ -25,6 +25,8 @@ namespace osu.Game.Utils { raven.Release = game.Version; + if (!game.IsDeployedBuild) return; + Logger.NewEntry += entry => { if (entry.Level < LogLevel.Verbose) return; From 99ace9805f25c54e164b07979ed0e16a4a54fcfe Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 17 Aug 2018 12:54:32 +0900 Subject: [PATCH 071/136] Fix mirror note generation never completing --- .../Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index 930ca26660..5860480a91 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -286,6 +286,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy /// The containing the hit objects. private Pattern generateRandomPatternWithMirrored(double centreProbability, double p2, double p3) { + if (convertType.HasFlag(PatternType.ForceNotStack)) + return generateRandomPattern(1 / 2f + p2 / 2, p2, (p2 + p3) / 2, p3); + var pattern = new Pattern(); bool addToCentre; @@ -370,9 +373,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { addToCentre = false; - if (convertType.HasFlag(PatternType.ForceNotStack)) - return getRandomNoteCount(1 / 2f + p2 / 2, p2, (p2 + p3) / 2, p3); - switch (TotalColumns) { case 2: From 7a8aabc402acc6ca16b8d7dafa2419be4354623d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 Aug 2018 13:18:48 +0900 Subject: [PATCH 072/136] Fix notifications suggesting automatic reporting in non-deployed builds --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index ecf5500ca4..d54bdee1b2 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -463,7 +463,7 @@ namespace osu.Game Schedule(() => notifications.Post(new SimpleNotification { Icon = entry.Level == LogLevel.Important ? FontAwesome.fa_exclamation_circle : FontAwesome.fa_bomb, - Text = entry.Message + (entry.Exception != null ? "\n\nThis error has been automatically reported to the devs." : string.Empty), + Text = entry.Message + (entry.Exception != null && IsDeployedBuild ? "\n\nThis error has been automatically reported to the devs." : string.Empty), })); } else if (recentLogCount == short_term_display_limit) From 3d6721111a8159a0a6ad9bebb9ded491cd952cb8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 17 Aug 2018 13:26:53 +0900 Subject: [PATCH 073/136] Increase the maximum allowable iterations during mania conversion --- osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs index 1eb0cdae2f..e51cbcdc60 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs @@ -18,8 +18,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns /// /// An arbitrary maximum amount of iterations to perform in . /// The specific value is not super important - enough such that no false-positives occur. + /// + /// /b/933228 requires at least 23 iterations. /// - private const int max_rng_iterations = 20; + private const int max_rng_iterations = 30; /// /// The last pattern. From 583e026906c46b5861bf30a3626dadc840fb5c13 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 Aug 2018 13:28:35 +0900 Subject: [PATCH 074/136] =?UTF-8?q?Don=E2=80=99t=20suppress=20unhandled=20?= =?UTF-8?q?exceptions=20in=20debug=20builds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- osu.Desktop/Program.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index db77427f96..71613753bc 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using osu.Framework; +using osu.Framework.Development; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.IPC; @@ -51,7 +52,7 @@ namespace osu.Desktop } } - private static int allowableExceptions = 1; + private static int allowableExceptions = DebugUtils.IsDebugBuild ? 0 : 1; /// /// Allow a maximum of one unhandled exception, per second of execution. From 16d30f6756d78cf9f38ac3e293c870e5b8653b0f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 17 Aug 2018 13:31:12 +0900 Subject: [PATCH 075/136] Add explanatory comments --- .../Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs | 2 ++ osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs index cb44fb1c8c..802080aedb 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs @@ -60,6 +60,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime) { + // Convert spinners don't create the new combo themselves, but force the next non-spinner hitobject to create a new combo + // Their combo offset is still added to that next hitobject's combo index forceNewCombo |= FormatVersion <= 8 || newCombo; extraComboOffset += comboOffset; diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs index 497d85f849..acd0de8688 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs @@ -61,6 +61,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu protected override HitObject CreateSpinner(Vector2 position, bool newCombo, int comboOffset, double endTime) { + // Convert spinners don't create the new combo themselves, but force the next non-spinner hitobject to create a new combo + // Their combo offset is still added to that next hitobject's combo index forceNewCombo |= FormatVersion <= 8 || newCombo; extraComboOffset += comboOffset; From 83bda313d1dc092332a71e4320d6285480fe5404 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 17 Aug 2018 13:50:27 +0900 Subject: [PATCH 076/136] Output the currently importing model --- osu.Game/Database/ArchiveModelManager.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index c00df59e3e..ac79a8f565 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -198,6 +198,8 @@ namespace osu.Game.Database try { + Logger.Log($"Importing {item}...", LoggingTarget.Database); + using (var write = ContextFactory.GetForWrite()) // used to share a context for full import. keep in mind this will block all writes. { try From 9a1e92800b4e799bfd5a058a921ddbc395ceec51 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 17 Aug 2018 14:30:44 +0900 Subject: [PATCH 077/136] Adjust with framework-side screenchanges --- osu.Game/Graphics/ScreenshotManager.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index 7b3337cb23..bc30794298 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Drawing.Imaging; using System.IO; using System.Threading; using System.Threading.Tasks; @@ -19,6 +18,7 @@ using osu.Game.Configuration; using osu.Game.Input.Bindings; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; +using SixLabors.ImageSharp; namespace osu.Game.Graphics { @@ -90,7 +90,7 @@ namespace osu.Game.Graphics waitDelegate.Cancel(); } - using (var bitmap = await host.TakeScreenshotAsync()) + using (var image = await host.TakeScreenshotAsync()) { Interlocked.Decrement(ref screenShotTasks); @@ -102,10 +102,10 @@ namespace osu.Game.Graphics switch (screenshotFormat.Value) { case ScreenshotFormat.Png: - bitmap.Save(stream, ImageFormat.Png); + image.SaveAsPng(stream); break; case ScreenshotFormat.Jpg: - bitmap.Save(stream, ImageFormat.Jpeg); + image.SaveAsJpeg(stream); break; default: throw new ArgumentOutOfRangeException(nameof(screenshotFormat)); From 442f6795bc8783a158738ea2bc388f6f02f63a9f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 Aug 2018 19:33:14 +0900 Subject: [PATCH 078/136] Block user input --- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 1 + osu.Game.Rulesets.Osu/OsuInputManager.cs | 31 ++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index 4e0c12f619..4047e057cb 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -84,6 +84,7 @@ namespace osu.Game.Rulesets.Osu.Mods { // grab the input manager for future use. osuInputManager = (OsuInputManager)rulesetContainer.KeyBindingInputManager; + osuInputManager.AllowUserPresses = false; } } } diff --git a/osu.Game.Rulesets.Osu/OsuInputManager.cs b/osu.Game.Rulesets.Osu/OsuInputManager.cs index d9ae836e0a..78ef0ec733 100644 --- a/osu.Game.Rulesets.Osu/OsuInputManager.cs +++ b/osu.Game.Rulesets.Osu/OsuInputManager.cs @@ -4,6 +4,8 @@ using System.Collections.Generic; using System.ComponentModel; using osu.Framework.Input.Bindings; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Osu @@ -12,8 +14,34 @@ namespace osu.Game.Rulesets.Osu { public IEnumerable PressedActions => KeyBindingContainer.PressedActions; - public OsuInputManager(RulesetInfo ruleset) : base(ruleset, 0, SimultaneousBindingMode.Unique) + public bool AllowUserPresses { + set => ((OsuKeyBindingContainer)KeyBindingContainer).AllowUserPresses = value; + } + + protected override RulesetKeyBindingContainer CreateKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique) + => new OsuKeyBindingContainer(ruleset, variant, unique); + + public OsuInputManager(RulesetInfo ruleset) + : base(ruleset, 0, SimultaneousBindingMode.Unique) + { + } + + private class OsuKeyBindingContainer : RulesetKeyBindingContainer + { + public bool AllowUserPresses = true; + + public OsuKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique) + : base(ruleset, variant, unique) + { + } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => AllowUserPresses && base.OnKeyDown( state,args); + protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) => AllowUserPresses && base.OnKeyUp( state,args); + protected override bool OnJoystickPress(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickPress( state,args); + protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickRelease( state,args); + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => AllowUserPresses && base.OnMouseDown( state,args); + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => AllowUserPresses && base.OnMouseUp( state,args); } } @@ -21,6 +49,7 @@ namespace osu.Game.Rulesets.Osu { [Description("Left Button")] LeftButton, + [Description("Right Button")] RightButton } From 41f8609e0fec70f285308adfad8860bfa68bca7a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 Aug 2018 20:13:14 +0900 Subject: [PATCH 079/136] Also handle OnScroll --- osu.Game.Rulesets.Osu/OsuInputManager.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/OsuInputManager.cs b/osu.Game.Rulesets.Osu/OsuInputManager.cs index 78ef0ec733..e7bbe755a0 100644 --- a/osu.Game.Rulesets.Osu/OsuInputManager.cs +++ b/osu.Game.Rulesets.Osu/OsuInputManager.cs @@ -36,12 +36,13 @@ namespace osu.Game.Rulesets.Osu { } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => AllowUserPresses && base.OnKeyDown( state,args); - protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) => AllowUserPresses && base.OnKeyUp( state,args); - protected override bool OnJoystickPress(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickPress( state,args); - protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickRelease( state,args); - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => AllowUserPresses && base.OnMouseDown( state,args); - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => AllowUserPresses && base.OnMouseUp( state,args); + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => AllowUserPresses && base.OnKeyDown(state, args); + protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) => AllowUserPresses && base.OnKeyUp(state, args); + protected override bool OnJoystickPress(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickPress(state, args); + protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickRelease(state, args); + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => AllowUserPresses && base.OnMouseDown(state, args); + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => AllowUserPresses && base.OnMouseUp(state, args); + protected override bool OnScroll(InputState state) => AllowUserPresses && base.OnScroll(state); } } From 6b0ed4a68d12f8867d498ab2c833423c946105d9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Aug 2018 13:37:59 +0900 Subject: [PATCH 080/136] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index da17500128..b4e9c748d9 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From e628e78f24a1601e3387e19f63821f0c805cddeb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Aug 2018 13:39:22 +0900 Subject: [PATCH 081/136] Update uniform usage --- osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 0532fe0223..abcd1ddbda 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -197,7 +197,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor if (Shared.VertexBuffer == null) Shared.VertexBuffer = new QuadVertexBuffer(max_sprites, BufferUsageHint.DynamicDraw); - Shader.GetUniform("g_FadeClock").Value = Time; + Shader.GetUniform("g_FadeClock").UpdateValue(ref Time); int updateStart = -1, updateEnd = 0; for (int i = 0; i < Parts.Length; ++i) From 18aa30fcb03c96a07ae6ecfaf02942025ea55b85 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Aug 2018 14:27:32 +0900 Subject: [PATCH 082/136] Unbind song select's ruleset to avoid test failures --- osu.Game/Screens/Select/SongSelect.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 54143bef8a..dcc0760262 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -460,6 +460,8 @@ namespace osu.Game.Screens.Select { base.Dispose(isDisposing); + Ruleset.UnbindAll(); + if (beatmaps != null) { beatmaps.ItemAdded -= onBeatmapSetAdded; From 65dc9f44e514ab816bbb2e1698774d4ba6724f17 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Aug 2018 14:42:37 +0900 Subject: [PATCH 083/136] Catch OperationCanceledException in single file load sequence --- osu.Game/OsuGame.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index d54bdee1b2..967cf95565 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -504,7 +504,16 @@ namespace osu.Game // schedule is here to ensure that all component loads are done after LoadComplete is run (and thus all dependencies are cached). // with some better organisation of LoadComplete to do construction and dependency caching in one step, followed by calls to loadComponentSingleFile, // we could avoid the need for scheduling altogether. - Schedule(() => { asyncLoadStream = asyncLoadStream?.ContinueWith(t => LoadComponentAsync(d, add).Wait()) ?? LoadComponentAsync(d, add); }); + Schedule(() => { asyncLoadStream = asyncLoadStream?.ContinueWith(async t => + { + try + { + await LoadComponentAsync(d, add); + } + catch (OperationCanceledException) + { + } + }) ?? LoadComponentAsync(d, add); }); } public bool OnPressed(GlobalAction action) From 39aa98d12de07050f459a0a0eeb219a2cfb079ce Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Aug 2018 14:58:02 +0900 Subject: [PATCH 084/136] Fix logo flying off-screen when exiting game --- osu.Game/Screens/Menu/ButtonSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index ce00686c02..7f2bc1d357 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -278,7 +278,7 @@ namespace osu.Game.Screens.Menu if (logo != null) { - if (logoTracking && iconFacade.IsLoaded) + if (logoTracking && logo.RelativePositionAxes == Axes.None && iconFacade.IsLoaded) logo.Position = logoTrackingPosition; iconFacade.Width = logo.SizeForFlow * 0.5f; From 295ccabf64e81b84cb386b9121f3390a4b132d72 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Aug 2018 16:06:12 +0900 Subject: [PATCH 085/136] Expand out on to multiple lines --- osu.Game/OsuGame.cs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 967cf95565..94678a9dde 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -504,16 +504,25 @@ namespace osu.Game // schedule is here to ensure that all component loads are done after LoadComplete is run (and thus all dependencies are cached). // with some better organisation of LoadComplete to do construction and dependency caching in one step, followed by calls to loadComponentSingleFile, // we could avoid the need for scheduling altogether. - Schedule(() => { asyncLoadStream = asyncLoadStream?.ContinueWith(async t => + Schedule(() => { - try + if (asyncLoadStream != null) { - await LoadComponentAsync(d, add); + //chain with existing load stream + asyncLoadStream = asyncLoadStream.ContinueWith(async t => + { + try + { + await LoadComponentAsync(d, add); + } + catch (OperationCanceledException) + { + } + }); } - catch (OperationCanceledException) - { - } - }) ?? LoadComponentAsync(d, add); }); + else + asyncLoadStream = LoadComponentAsync(d, add); + }); } public bool OnPressed(GlobalAction action) From 7add4a8cc75df572fa695860f6abd52a021adeb7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 20 Aug 2018 18:26:34 +0900 Subject: [PATCH 086/136] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b4e9c748d9..06fb1c4f82 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 4a68b14447fd082f7c973ffa9def4e1943da21b3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Aug 2018 00:15:51 +0900 Subject: [PATCH 087/136] Fix crash when selecting mods after entering play mode Closes #3260. --- osu.Game/Screens/Play/HUD/ModDisplay.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 894322dd41..1a164b473d 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -63,6 +63,12 @@ namespace osu.Game.Screens.Play.HUD }; } + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + mods.UnbindAll(); + } + protected override void LoadComplete() { base.LoadComplete(); From da13266ae95f28b1121ce7df7f193dd832cfa807 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Aug 2018 09:17:44 +0900 Subject: [PATCH 088/136] Fix missed string interpolation --- osu.Desktop/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 71613753bc..257155478f 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -63,7 +63,7 @@ namespace osu.Desktop { bool continueExecution = Interlocked.Decrement(ref allowableExceptions) >= 0; - Logger.Log($"Unhandled exception has been {(continueExecution ? "allowed with {allowableExceptions} more allowable exceptions" : "denied")} ."); + Logger.Log($"Unhandled exception has been {(continueExecution ? $"allowed with {allowableExceptions} more allowable exceptions" : "denied")} ."); // restore the stock of allowable exceptions after a short delay. Task.Delay(1000).ContinueWith(_ => Interlocked.Increment(ref allowableExceptions)); From 541c4daa810ad3700e7381b9a0f3dddfbc796749 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Aug 2018 11:10:54 +0900 Subject: [PATCH 089/136] Use ordinal string comparison in hot paths --- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 4 ++-- osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 76a3d75e36..e9f37e583b 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -31,7 +31,7 @@ namespace osu.Game.Beatmaps.Formats if (ShouldSkipLine(line)) continue; - if (line.StartsWith(@"[") && line.EndsWith(@"]")) + if (line.StartsWith(@"[", StringComparison.Ordinal) && line.EndsWith(@"]", StringComparison.Ordinal)) { if (!Enum.TryParse(line.Substring(1, line.Length - 2), out section)) { @@ -53,7 +53,7 @@ namespace osu.Game.Beatmaps.Formats } } - protected virtual bool ShouldSkipLine(string line) => string.IsNullOrWhiteSpace(line) || line.StartsWith("//"); + protected virtual bool ShouldSkipLine(string line) => string.IsNullOrWhiteSpace(line) || line.StartsWith("//", StringComparison.Ordinal); protected virtual void ParseLine(T output, Section section, string line) { diff --git a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs index a8a62013b1..1063dfc923 100644 --- a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs @@ -60,7 +60,7 @@ namespace osu.Game.Beatmaps.Formats private void handleEvents(string line) { var depth = 0; - while (line.StartsWith(" ") || line.StartsWith("_")) + while (line.StartsWith(" ", StringComparison.Ordinal) || line.StartsWith("_", StringComparison.Ordinal)) { ++depth; line = line.Substring(1); From fcf98390f56b0e5cca645d8f7f255d9fc1c8731b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Aug 2018 12:10:00 +0900 Subject: [PATCH 090/136] Cleanup --- osu.Game/Rulesets/UI/Playfield.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index 7a7ada3435..da14fb54d6 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -56,9 +56,10 @@ namespace osu.Game.Rulesets.UI private WorkingBeatmap beatmap; [BackgroundDependencyLoader] - private void load(IBindableBeatmap bBeatmap) + private void load(IBindableBeatmap beatmap) { - beatmap = bBeatmap.Value; + this.beatmap = beatmap.Value; + HitObjects = CreateHitObjectContainer(); HitObjects.RelativeSizeAxes = Axes.Both; From 34b1abeca3c1eb544d563539420492ec6838f6ef Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Aug 2018 12:10:43 +0900 Subject: [PATCH 091/136] Remove sliderball's input override --- .../Objects/Drawables/Pieces/SliderBall.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 182cf66df8..b11e4fc971 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input.EventArgs; using osu.Framework.Input.States; using osu.Game.Rulesets.Objects.Types; -using OpenTK; using OpenTK.Graphics; using osu.Game.Skinning; @@ -121,9 +120,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces return base.OnMouseMove(state); } - // If the current time is between the start and end of the slider, we should track mouse input regardless of the cursor position. - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => canCurrentlyTrack || base.ReceiveMouseInputAt(screenSpacePos); - public override void ClearTransformsAfter(double time, bool propagateChildren = false, string targetMember = null) { // Consider the case of rewinding - children's transforms are handled internally, so propagating down @@ -158,7 +154,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces // Make sure to use the base version of ReceiveMouseInputAt so that we correctly check the position. Tracking = canCurrentlyTrack && lastState != null - && base.ReceiveMouseInputAt(lastState.Mouse.NativeState.Position) + && ReceiveMouseInputAt(lastState.Mouse.NativeState.Position) && ((Parent as DrawableSlider)?.OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false); } } From d14dad64e85c0fc4d5e15577b708b675b4c37654 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Aug 2018 16:01:28 +0900 Subject: [PATCH 092/136] Fix hitobject stacking being applied too early --- osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs index 5fe2457645..cfb1b0f050 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs @@ -15,9 +15,9 @@ namespace osu.Game.Rulesets.Osu.Beatmaps { } - public override void PreProcess() + public override void PostProcess() { - base.PreProcess(); + base.PostProcess(); applyStacking((Beatmap)Beatmap); } From 8b795cd52a2bbb7b955d73564c2c6d904505c11c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 21 Aug 2018 17:22:28 +0900 Subject: [PATCH 093/136] Add very simple stacking test --- osu.Game.Rulesets.Osu.Tests/StackingTest.cs | 64 +++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 osu.Game.Rulesets.Osu.Tests/StackingTest.cs diff --git a/osu.Game.Rulesets.Osu.Tests/StackingTest.cs b/osu.Game.Rulesets.Osu.Tests/StackingTest.cs new file mode 100644 index 0000000000..579cb77084 --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/StackingTest.cs @@ -0,0 +1,64 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.IO; +using System.Linq; +using System.Text; +using NUnit.Framework; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Tests.Beatmaps; +using Decoder = osu.Game.Beatmaps.Formats.Decoder; + +namespace osu.Game.Rulesets.Osu.Tests +{ + [TestFixture] + public class StackingTest + { + [Test] + public void TestStacking() + { + using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(beatmap_data))) + using (var reader = new StreamReader(stream)) + { + var beatmap = Decoder.GetDecoder(reader).Decode(reader); + var converted = new TestWorkingBeatmap(beatmap).GetPlayableBeatmap(new OsuRuleset().RulesetInfo); + + var objects = converted.HitObjects.ToList(); + + // The last hitobject triggers the stacking + for (int i = 0; i < objects.Count - 1; i++) + Assert.AreEqual(0, ((OsuHitObject)objects[i]).StackHeight); + } + } + + private const string beatmap_data = @" +osu file format v14 + +[General] +StackLeniency: 0.2 + +[Difficulty] +ApproachRate:9.2 +SliderMultiplier:1 +SliderTickRate:0.5 + +[TimingPoints] +217871,6400,4,2,1,20,1,0 +217871,-800,4,2,1,20,0,0 +218071,-787.5,4,2,1,20,0,0 +218271,-775,4,2,1,20,0,0 +218471,-762.5,4,2,1,20,0,0 +218671,-750,4,2,1,20,0,0 +240271,-10,4,2,0,5,0,0 + +[HitObjects] +311,185,217871,6,0,L|318:158,1,25 +311,185,218071,2,0,L|335:170,1,25 +311,185,218271,2,0,L|338:192,1,25 +311,185,218471,2,0,L|325:209,1,25 +311,185,218671,2,0,L|304:212,1,25 +311,185,240271,5,0,0:0:0:0: +"; + } +} From c97548804e5acf8c71d6cb5a186f5e8823c9646a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Aug 2018 18:46:44 +0900 Subject: [PATCH 094/136] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 06fb1c4f82..2115453c5e 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 4cd21fabf34e59956740ad78f5703285baced4b7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 21 Aug 2018 19:16:07 +0900 Subject: [PATCH 095/136] Remove extra newlines --- osu.Game/Graphics/UserInterface/TriangleButton.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/TriangleButton.cs b/osu.Game/Graphics/UserInterface/TriangleButton.cs index e85ef9dac1..683b442d93 100644 --- a/osu.Game/Graphics/UserInterface/TriangleButton.cs +++ b/osu.Game/Graphics/UserInterface/TriangleButton.cs @@ -27,7 +27,6 @@ namespace osu.Game.Graphics.UserInterface }); } - public IEnumerable FilterTerms => new[] { Text }; public bool MatchingFilter @@ -37,6 +36,5 @@ namespace osu.Game.Graphics.UserInterface this.FadeTo(value ? 1 : 0); } } - } } From 2bc827fa0c493a5ab552d42486c917682691955d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 22 Aug 2018 11:32:00 +0900 Subject: [PATCH 096/136] Fix taiko beatmap conversion attempting to make strong swells --- osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index acd6d43284..c2cde332e8 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps converted.HitObjects = converted.HitObjects.GroupBy(t => t.StartTime).Select(x => { TaikoHitObject first = x.First(); - if (x.Skip(1).Any()) + if (x.Skip(1).Any() && !(first is Swell)) first.IsStrong = true; return first; }).ToList(); From ce367bcc421f8865a4ef249767100667968a8bd9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 22 Aug 2018 12:02:14 +0900 Subject: [PATCH 097/136] Fix invalid GC latency mode being set --- .../Settings/Sections/Debug/GCSettings.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs b/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs index 9f550413f3..b14a4b8773 100644 --- a/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs @@ -13,15 +13,18 @@ namespace osu.Game.Overlays.Settings.Sections.Debug { protected override string Header => "Garbage Collector"; + private readonly Bindable latencyMode = new Bindable(); + private Bindable configLatencyMode; + [BackgroundDependencyLoader] private void load(FrameworkDebugConfigManager config) { Children = new Drawable[] { - new SettingsEnumDropdown + new SettingsEnumDropdown { LabelText = "Active mode", - Bindable = config.GetBindable(DebugSetting.ActiveGCMode) + Bindable = latencyMode }, new SettingsButton { @@ -29,6 +32,18 @@ namespace osu.Game.Overlays.Settings.Sections.Debug Action = GC.Collect }, }; + + configLatencyMode = config.GetBindable(DebugSetting.ActiveGCMode); + configLatencyMode.BindValueChanged(v => latencyMode.Value = (LatencyMode)v, true); + latencyMode.BindValueChanged(v => configLatencyMode.Value = (GCLatencyMode)v); + } + + private enum LatencyMode + { + Batch = GCLatencyMode.Batch, + Interactive = GCLatencyMode.Interactive, + LowLatency = GCLatencyMode.LowLatency, + SustainedLowLatency = GCLatencyMode.SustainedLowLatency } } } From 50b8daf9390268cf2d94a897baf47681e31d314e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 22 Aug 2018 14:07:52 +0900 Subject: [PATCH 098/136] Fix threads being cross-disposed from DatabaseContextFactory --- osu.Game/Database/DatabaseContextFactory.cs | 5 +++-- osu.Game/Database/OsuDbContext.cs | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/DatabaseContextFactory.cs b/osu.Game/Database/DatabaseContextFactory.cs index e70d753114..2037612a09 100644 --- a/osu.Game/Database/DatabaseContextFactory.cs +++ b/osu.Game/Database/DatabaseContextFactory.cs @@ -5,7 +5,6 @@ using System; using System.Linq; using System.Threading; using Microsoft.EntityFrameworkCore.Storage; -using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Platform; namespace osu.Game.Database @@ -118,7 +117,9 @@ namespace osu.Game.Database private void recycleThreadContexts() { - threadContexts?.Values.ForEach(c => c.Dispose()); + // Contexts for other threads are not disposed as they may be in use elsewhere. Instead, fresh contexts are exposed + // for other threads to use, and we rely on the finalizer inside OsuDbContext to handle their previous contexts + threadContexts?.Value.Dispose(); threadContexts = new ThreadLocal(CreateContext, true); } diff --git a/osu.Game/Database/OsuDbContext.cs b/osu.Game/Database/OsuDbContext.cs index bf57644caf..20e144c033 100644 --- a/osu.Game/Database/OsuDbContext.cs +++ b/osu.Game/Database/OsuDbContext.cs @@ -75,6 +75,13 @@ namespace osu.Game.Database } } + ~OsuDbContext() + { + // DbContext does not contain a finalizer (https://github.com/aspnet/EntityFrameworkCore/issues/8872) + // This is used to clean up previous contexts when fresh contexts are exposed via DatabaseContextFactory + Dispose(); + } + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { base.OnConfiguring(optionsBuilder); From df848896463c8d9319fece673379d31b43599c27 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 22 Aug 2018 14:50:03 +0900 Subject: [PATCH 099/136] Handle invalid origins as Anchor.TopLeft --- osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs index 1063dfc923..a73a32325a 100644 --- a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs @@ -269,9 +269,9 @@ namespace osu.Game.Beatmaps.Formats return Anchor.BottomCentre; case LegacyOrigins.BottomRight: return Anchor.BottomRight; + default: + return Anchor.TopLeft; } - - throw new InvalidDataException($@"Unknown origin: {value}"); } private void handleVariables(string line) From bdd618a99deaf091abb8626b3d094dbdf2b3f257 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 22 Aug 2018 15:42:43 +0900 Subject: [PATCH 100/136] Log the archive when failing to create model --- osu.Game/Beatmaps/BeatmapManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 1c28b533d2..e31746457a 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -350,7 +350,8 @@ namespace osu.Game.Beatmaps { // let's make sure there are actually .osu files to import. string mapName = reader.Filenames.FirstOrDefault(f => f.EndsWith(".osu")); - if (string.IsNullOrEmpty(mapName)) throw new InvalidOperationException("No beatmap files found in this beatmap archive."); + if (string.IsNullOrEmpty(mapName)) + throw new InvalidOperationException($"No beatmap files found in this beatmap archive. ({reader.Name})"); Beatmap beatmap; using (var stream = new StreamReader(reader.GetStream(mapName))) From 551581e5cdde3f42ea7496da5b873a90a3da7dcb Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 22 Aug 2018 15:35:29 +0900 Subject: [PATCH 101/136] Skip invalid hitobject types, log error instead --- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 3 --- .../Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 8 +++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 31a7698f50..181d17932d 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -408,11 +408,8 @@ namespace osu.Game.Beatmaps.Formats parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(getOffsetTime(), FormatVersion); var obj = parser.Parse(line); - if (obj != null) - { beatmap.HitObjects.Add(obj); - } } private int getOffsetTime(int time) => time + (ApplyOffsets ? offset : 0); diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 8236333a3f..72168a4cd2 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -10,6 +10,8 @@ using System.IO; using osu.Game.Beatmaps.Formats; using osu.Game.Audio; using System.Linq; +using JetBrains.Annotations; +using osu.Framework.Logging; using osu.Framework.MathUtils; namespace osu.Game.Rulesets.Objects.Legacy @@ -37,6 +39,7 @@ namespace osu.Game.Rulesets.Objects.Legacy FormatVersion = formatVersion; } + [CanBeNull] public override HitObject Parse(string text) { try @@ -191,7 +194,10 @@ namespace osu.Game.Rulesets.Objects.Legacy } if (result == null) - throw new InvalidOperationException($@"Unknown hit object type {type}."); + { + Logger.Log($"Unknown hit object type: {type}. Skipped.", level: LogLevel.Error); + return null; + } result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture) + Offset; result.Samples = convertSoundType(soundType, bankInfo); From 2fb62827e2a6ecb101300235339e3d824bcca5e2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 22 Aug 2018 16:01:58 +0900 Subject: [PATCH 102/136] Soft-handle errors when beatmap contains no objects --- 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 2e23bb16f0..5ad0130fd7 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -124,7 +124,7 @@ namespace osu.Game.Screens.Play if (!RulesetContainer.Objects.Any()) { - Logger.Error(new InvalidOperationException("Beatmap contains no hit objects!"), "Beatmap contains no hit objects!"); + Logger.Log("Beatmap contains no hit objects!", level: LogLevel.Error); return; } } From f1c6dfd735e885178cc5b4dccea6c60a91167fcb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Aug 2018 16:22:29 +0900 Subject: [PATCH 103/136] Change grammar slightly --- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index e31746457a..fc5a967f2d 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -351,7 +351,7 @@ namespace osu.Game.Beatmaps // let's make sure there are actually .osu files to import. string mapName = reader.Filenames.FirstOrDefault(f => f.EndsWith(".osu")); if (string.IsNullOrEmpty(mapName)) - throw new InvalidOperationException($"No beatmap files found in this beatmap archive. ({reader.Name})"); + throw new InvalidOperationException($"No beatmap files found in this beatmap archive ({reader.Name})."); Beatmap beatmap; using (var stream = new StreamReader(reader.GetStream(mapName))) From 9cbead55d62677653a583ccbddf7dbd169262ad5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Aug 2018 17:41:13 +0900 Subject: [PATCH 104/136] Add a second parallax layer to break overlay arrows --- osu.Game/Screens/Play/Break/BreakArrows.cs | 39 +++++++++++++--------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/osu.Game/Screens/Play/Break/BreakArrows.cs b/osu.Game/Screens/Play/Break/BreakArrows.cs index 4a4a7960fa..1382aa9d9d 100644 --- a/osu.Game/Screens/Play/Break/BreakArrows.cs +++ b/osu.Game/Screens/Play/Break/BreakArrows.cs @@ -31,23 +31,30 @@ namespace osu.Game.Screens.Play.Break RelativeSizeAxes = Axes.Both; InternalChildren = new Drawable[] { - leftGlowIcon = new GlowIcon + new ParallaxContainer { - Anchor = Anchor.Centre, - Origin = Anchor.CentreRight, - X = -glow_icon_offscreen_offset, - Icon = Graphics.FontAwesome.fa_chevron_right, - BlurSigma = new Vector2(glow_icon_blur_sigma), - Size = new Vector2(glow_icon_size), - }, - rightGlowIcon = new GlowIcon - { - Anchor = Anchor.Centre, - Origin = Anchor.CentreLeft, - X = glow_icon_offscreen_offset, - Icon = Graphics.FontAwesome.fa_chevron_left, - BlurSigma = new Vector2(glow_icon_blur_sigma), - Size = new Vector2(glow_icon_size), + ParallaxAmount = -0.01f, + Children = new Drawable[] + { + leftGlowIcon = new GlowIcon + { + Anchor = Anchor.Centre, + Origin = Anchor.CentreRight, + X = -glow_icon_offscreen_offset, + Icon = Graphics.FontAwesome.fa_chevron_right, + BlurSigma = new Vector2(glow_icon_blur_sigma), + Size = new Vector2(glow_icon_size), + }, + rightGlowIcon = new GlowIcon + { + Anchor = Anchor.Centre, + Origin = Anchor.CentreLeft, + X = glow_icon_offscreen_offset, + Icon = Graphics.FontAwesome.fa_chevron_left, + BlurSigma = new Vector2(glow_icon_blur_sigma), + Size = new Vector2(glow_icon_size), + }, + } }, new ParallaxContainer { From 6475dfaeef6c0c51dbb28cc05d0dfa3e9bf1674e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 23 Aug 2018 09:14:55 +0900 Subject: [PATCH 105/136] Allow 2B maps to be converted to mania --- .../Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index 5860480a91..b2b9fe2446 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -25,9 +25,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy PatternType lastStair, IBeatmap originalBeatmap) : base(random, hitObject, beatmap, previousPattern, originalBeatmap) { - if (previousTime > hitObject.StartTime) throw new ArgumentOutOfRangeException(nameof(previousTime)); - if (density < 0) throw new ArgumentOutOfRangeException(nameof(density)); - StairType = lastStair; TimingControlPoint timingPoint = beatmap.ControlPointInfo.TimingPointAt(hitObject.StartTime); From 8f261988f781f81fa11ee5c0f94a12d3834263de Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 23 Aug 2018 10:56:52 +0900 Subject: [PATCH 106/136] Log all files when no beatmap files in archive error occurs --- osu.Game/Beatmaps/BeatmapManager.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index fc5a967f2d..1a2b5eadd9 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -351,7 +351,11 @@ namespace osu.Game.Beatmaps // let's make sure there are actually .osu files to import. string mapName = reader.Filenames.FirstOrDefault(f => f.EndsWith(".osu")); if (string.IsNullOrEmpty(mapName)) - throw new InvalidOperationException($"No beatmap files found in this beatmap archive ({reader.Name})."); + { + // Todo: This is temporary for debugging purposes + var files = reader.Filenames.ToList(); + throw new InvalidOperationException($"No beatmap files found in this beatmap archive. Files ({files.Count}): {string.Join(", ", files)}"); + } Beatmap beatmap; using (var stream = new StreamReader(reader.GetStream(mapName))) From 9f3f07df2e1a977797dc27a0b802663e96d7733e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Aug 2018 11:20:20 +0900 Subject: [PATCH 107/136] Fix notifications appearing too early in load process --- osu.Game/Overlays/NotificationOverlay.cs | 3 +-- osu.Game/Screens/Loader.cs | 3 +++ osu.Game/Screens/Menu/ButtonSystem.cs | 15 +++++---------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index d891cd96e8..78f8f57343 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -96,8 +96,7 @@ namespace osu.Game.Overlays base.LoadComplete(); StateChanged += _ => updateProcessingMode(); - OverlayActivationMode.ValueChanged += _ => updateProcessingMode(); - OverlayActivationMode.TriggerChange(); + OverlayActivationMode.BindValueChanged(_ => updateProcessingMode(), true); } private int totalCount => sections.Select(c => c.DisplayedCount).Sum(); diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index c3b3e747fd..3cef20e510 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics.Shaders; using osu.Game.Screens.Menu; using OpenTK; using osu.Framework.Screens; +using osu.Game.Overlays; namespace osu.Game.Screens { @@ -18,6 +19,8 @@ namespace osu.Game.Screens protected override bool HideOverlaysOnEnter => true; + protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled; + protected override bool AllowBackButton => false; public Loader() diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 7f2bc1d357..b9a799328e 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -174,6 +174,9 @@ namespace osu.Game.Screens.Menu ButtonSystemState lastState = state; state = value; + if (game != null) + game.OverlayActivationMode.Value = state == ButtonSystemState.Exit ? OverlayActivation.Disabled : OverlayActivation.All; + updateLogoState(lastState); Logger.Log($"{nameof(ButtonSystem)}'s state changed from {lastState} to {state}"); @@ -205,11 +208,7 @@ namespace osu.Game.Screens.Menu { logoTracking = false; - if (game != null) - { - game.OverlayActivationMode.Value = state == ButtonSystemState.Exit ? OverlayActivation.Disabled : OverlayActivation.All; - game.Toolbar.Hide(); - } + game?.Toolbar.Hide(); logo.ClearTransforms(targetMember: nameof(Position)); logo.RelativePositionAxes = Axes.Both; @@ -243,11 +242,7 @@ namespace osu.Game.Screens.Menu if (impact) logo.Impact(); - if (game != null) - { - game.OverlayActivationMode.Value = OverlayActivation.All; - game.Toolbar.State = Visibility.Visible; - } + game?.Toolbar.Show(); }, 200); break; default: From c7db40783221ab1bbbc28feb2d0898af0ceec528 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 23 Aug 2018 14:53:16 +0900 Subject: [PATCH 108/136] Fix operation cancelled exception when changing visual settings --- osu.Game/Skinning/LocalSkinOverrideContainer.cs | 6 ++---- osu.Game/Skinning/SkinReloadableDrawable.cs | 7 +++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index 3adf287cf7..25d9442e6f 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -85,12 +85,10 @@ namespace osu.Game.Skinning private void load(OsuConfigManager config) { beatmapSkins = config.GetBindable(OsuSetting.BeatmapSkins); - beatmapSkins.ValueChanged += val => onSourceChanged(); - beatmapSkins.TriggerChange(); + beatmapSkins.BindValueChanged(_ => onSourceChanged()); beatmapHitsounds = config.GetBindable(OsuSetting.BeatmapHitsounds); - beatmapHitsounds.ValueChanged += val => onSourceChanged(); - beatmapHitsounds.TriggerChange(); + beatmapHitsounds.BindValueChanged(_ => onSourceChanged(), true); } protected override void LoadComplete() diff --git a/osu.Game/Skinning/SkinReloadableDrawable.cs b/osu.Game/Skinning/SkinReloadableDrawable.cs index f1ee0db6ce..3ff28ab871 100644 --- a/osu.Game/Skinning/SkinReloadableDrawable.cs +++ b/osu.Game/Skinning/SkinReloadableDrawable.cs @@ -52,5 +52,12 @@ namespace osu.Game.Skinning protected virtual void SkinChanged(ISkinSource skin, bool allowFallback) { } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + skin.SourceChanged -= onChange; + } } } From 90ebabd2db4c94edddc20eb134f75a1426dee9b3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 23 Aug 2018 15:21:36 +0900 Subject: [PATCH 109/136] Fix nullref --- osu.Game/Skinning/SkinReloadableDrawable.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Skinning/SkinReloadableDrawable.cs b/osu.Game/Skinning/SkinReloadableDrawable.cs index 3ff28ab871..0b94697405 100644 --- a/osu.Game/Skinning/SkinReloadableDrawable.cs +++ b/osu.Game/Skinning/SkinReloadableDrawable.cs @@ -57,7 +57,8 @@ namespace osu.Game.Skinning { base.Dispose(isDisposing); - skin.SourceChanged -= onChange; + if (skin != null) + skin.SourceChanged -= onChange; } } } From 407968bb7e2f86d11a5582b69bd284dcd5ce4768 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 24 Aug 2018 10:03:56 +0900 Subject: [PATCH 110/136] Log the format line when a decoder isn't found --- osu.Game/Beatmaps/Formats/Decoder.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/Decoder.cs b/osu.Game/Beatmaps/Formats/Decoder.cs index 2927654f62..759d6d14d1 100644 --- a/osu.Game/Beatmaps/Formats/Decoder.cs +++ b/osu.Game/Beatmaps/Formats/Decoder.cs @@ -55,11 +55,11 @@ namespace osu.Game.Beatmaps.Formats } while (line != null && line.Length == 0); if (line == null) - throw new IOException(@"Unknown file format"); + throw new IOException(@"Unknown file format (null)"); var decoder = typedDecoders.Select(d => line.StartsWith(d.Key) ? d.Value : null).FirstOrDefault(); if (decoder == null) - throw new IOException(@"Unknown file format"); + throw new IOException($@"Unknown file format ({line})"); return (Decoder)decoder.Invoke(line); } From 55370165c0487e5a1cc606ab554fe7cb1e965b5b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 24 Aug 2018 10:12:30 +0900 Subject: [PATCH 111/136] Compare with invariant culture --- osu.Game/Beatmaps/Formats/Decoder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/Formats/Decoder.cs b/osu.Game/Beatmaps/Formats/Decoder.cs index 759d6d14d1..6f45718390 100644 --- a/osu.Game/Beatmaps/Formats/Decoder.cs +++ b/osu.Game/Beatmaps/Formats/Decoder.cs @@ -57,7 +57,7 @@ namespace osu.Game.Beatmaps.Formats if (line == null) throw new IOException(@"Unknown file format (null)"); - var decoder = typedDecoders.Select(d => line.StartsWith(d.Key) ? d.Value : null).FirstOrDefault(); + var decoder = typedDecoders.Select(d => line.StartsWith(d.Key, StringComparison.InvariantCulture) ? d.Value : null).FirstOrDefault(); if (decoder == null) throw new IOException($@"Unknown file format ({line})"); From 59d6ccbaab7796c16aefc6a223e3675bf4bceee2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 24 Aug 2018 15:27:13 +0900 Subject: [PATCH 112/136] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 2115453c5e..69d242daa9 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 1a2c3715c762406e8a6cfe93237cfcdb6b25466a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 24 Aug 2018 15:50:39 +0900 Subject: [PATCH 113/136] Fix testcase dodginess --- osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs b/osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs index e4cb848d90..041fce6ce3 100644 --- a/osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs +++ b/osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs @@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load() { - AddInternal(trackManager); + Add(trackManager); } [Test] @@ -75,7 +75,7 @@ namespace osu.Game.Tests.Visual TestTrackOwner owner = null; PreviewTrack track = null; - AddStep("get track", () => AddInternal(owner = new TestTrackOwner(track = getTrack()))); + AddStep("get track", () => Add(owner = new TestTrackOwner(track = getTrack()))); AddStep("start", () => track.Start()); AddStep("attempt stop", () => trackManager.StopAnyPlaying(this)); AddAssert("not stopped", () => track.IsRunning); @@ -89,7 +89,7 @@ namespace osu.Game.Tests.Visual { var track = getTrack(); - AddInternal(track); + Add(track); return track; } From 99574ecad81e3294ea21c963ad139df1b3b3b381 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 24 Aug 2018 17:57:39 +0900 Subject: [PATCH 114/136] Softly handle errors when no beatmap file exists in archive --- osu.Game/Beatmaps/BeatmapManager.cs | 5 ++--- osu.Game/Database/ArchiveModelManager.cs | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 1a2b5eadd9..3a12f26863 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -352,9 +352,8 @@ namespace osu.Game.Beatmaps string mapName = reader.Filenames.FirstOrDefault(f => f.EndsWith(".osu")); if (string.IsNullOrEmpty(mapName)) { - // Todo: This is temporary for debugging purposes - var files = reader.Filenames.ToList(); - throw new InvalidOperationException($"No beatmap files found in this beatmap archive. Files ({files.Count}): {string.Join(", ", files)}"); + Logger.Log($"No beatmap files found in the beatmap archive ({reader.Name}). Skipping."); + return null; } Beatmap beatmap; diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index ac79a8f565..42dd6684d5 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -178,7 +178,8 @@ namespace osu.Game.Database { try { - return Import(CreateModel(archive), archive); + var model = CreateModel(archive); + return model == null ? null : Import(model, archive); } catch (Exception e) { From aeb4d47c06e57485ecb23f249133e804bf82b076 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 24 Aug 2018 18:07:39 +0900 Subject: [PATCH 115/136] Remove skipping part of message --- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 3a12f26863..d2be36e991 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -352,7 +352,7 @@ namespace osu.Game.Beatmaps string mapName = reader.Filenames.FirstOrDefault(f => f.EndsWith(".osu")); if (string.IsNullOrEmpty(mapName)) { - Logger.Log($"No beatmap files found in the beatmap archive ({reader.Name}). Skipping."); + Logger.Log($"No beatmap files found in the beatmap archive ({reader.Name})."); return null; } From 26dfabc86c1d90c575eaf6d8523fb685708e0f67 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 24 Aug 2018 23:57:44 +0900 Subject: [PATCH 116/136] Aggressively check for valid columns before iterating endlessly --- .../Legacy/DistanceObjectPatternGenerator.cs | 58 +++----------- .../Legacy/EndTimeObjectPatternGenerator.cs | 21 +---- .../Legacy/HitObjectPatternGenerator.cs | 34 ++++---- .../Patterns/Legacy/PatternGenerator.cs | 79 +++++++++++++++++++ .../Beatmaps/Patterns/PatternGenerator.cs | 45 ----------- 5 files changed, 110 insertions(+), 127 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 010cf962cc..37a8062d75 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -173,26 +173,18 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy var pattern = new Pattern(); int usableColumns = TotalColumns - RandomStart - PreviousPattern.ColumnWithObjects; - int nextColumn = Random.Next(RandomStart, TotalColumns); + int nextColumn = GetRandomColumn(); for (int i = 0; i < Math.Min(usableColumns, noteCount); i++) { // Find available column - RunWhile(() => pattern.ColumnHasObject(nextColumn) || PreviousPattern.ColumnHasObject(nextColumn), () => - { - nextColumn = Random.Next(RandomStart, TotalColumns); - }); - + nextColumn = FindAvailableColumn(nextColumn, pattern, PreviousPattern); addToPattern(pattern, nextColumn, startTime, EndTime); } // This is can't be combined with the above loop due to RNG for (int i = 0; i < noteCount - usableColumns; i++) { - RunWhile(() => pattern.ColumnHasObject(nextColumn), () => - { - nextColumn = Random.Next(RandomStart, TotalColumns); - }); - + nextColumn = FindAvailableColumn(nextColumn, pattern); addToPattern(pattern, nextColumn, startTime, EndTime); } @@ -217,23 +209,13 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns) - { - RunWhile(() => PreviousPattern.ColumnHasObject(nextColumn), () => - { - nextColumn = Random.Next(RandomStart, TotalColumns); - }); - } + nextColumn = FindAvailableColumn(nextColumn, PreviousPattern); int lastColumn = nextColumn; for (int i = 0; i < noteCount; i++) { addToPattern(pattern, nextColumn, startTime, startTime); - - RunWhile(() => nextColumn == lastColumn, () => - { - nextColumn = Random.Next(RandomStart, TotalColumns); - }); - + nextColumn = FindAvailableColumn(nextColumn, validation: c => c != lastColumn); lastColumn = nextColumn; startTime += SegmentDuration; } @@ -325,7 +307,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (TotalColumns > 2) addToPattern(pattern, nextColumn, startTime, startTime); - nextColumn = Random.Next(RandomStart, TotalColumns); + nextColumn = GetRandomColumn(); startTime += SegmentDuration; } @@ -404,20 +386,11 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns) - { - RunWhile(() => PreviousPattern.ColumnHasObject(nextColumn), () => - { - nextColumn = Random.Next(RandomStart, TotalColumns); - }); - } + nextColumn = FindAvailableColumn(nextColumn, PreviousPattern); for (int i = 0; i < columnRepeat; i++) { - RunWhile(() => pattern.ColumnHasObject(nextColumn), () => - { - nextColumn = Random.Next(RandomStart, TotalColumns); - }); - + nextColumn = FindAvailableColumn(nextColumn, pattern); addToPattern(pattern, nextColumn, startTime, EndTime); startTime += SegmentDuration; } @@ -442,17 +415,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int holdColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns) - { - RunWhile(() => PreviousPattern.ColumnHasObject(holdColumn), () => - { - holdColumn = Random.Next(RandomStart, TotalColumns); - }); - } + holdColumn = FindAvailableColumn(holdColumn, PreviousPattern); // Create the hold note addToPattern(pattern, holdColumn, startTime, EndTime); - int nextColumn = Random.Next(RandomStart, TotalColumns); + int nextColumn = GetRandomColumn(); int noteCount; if (ConversionDifficulty > 6.5) noteCount = GetRandomNoteCount(0.63, 0); @@ -473,11 +441,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { for (int j = 0; j < noteCount; j++) { - RunWhile(() => rowPattern.ColumnHasObject(nextColumn) || nextColumn == holdColumn, () => - { - nextColumn = Random.Next(RandomStart, TotalColumns); - }); - + nextColumn = FindAvailableColumn(nextColumn, validation: c => c != holdColumn, patterns: rowPattern); addToPattern(rowPattern, nextColumn, startTime, startTime); } } diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs index eae9a0fc3b..775a4145e6 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs @@ -39,34 +39,17 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy addToPattern(pattern, 0, generateHold); break; case 8: - addToPattern(pattern, getNextRandomColumn(RandomStart), generateHold); + addToPattern(pattern, FindAvailableColumn(GetRandomColumn(), PreviousPattern), generateHold); break; default: if (TotalColumns > 0) - addToPattern(pattern, getNextRandomColumn(0), generateHold); + addToPattern(pattern, GetRandomColumn(), generateHold); break; } return pattern; } - /// - /// Picks a random column after a column. - /// - /// The starting column. - /// A random column after . - private int getNextRandomColumn(int start) - { - int nextColumn = Random.Next(start, TotalColumns); - - RunWhile(() => PreviousPattern.ColumnHasObject(nextColumn), () => - { - nextColumn = Random.Next(start, TotalColumns); - }); - - return nextColumn; - } - /// /// Constructs and adds a note to a pattern. /// diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index b2b9fe2446..da1dd62cf5 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -231,22 +231,27 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); for (int i = 0; i < noteCount; i++) { - RunWhile(() => pattern.ColumnHasObject(nextColumn) || PreviousPattern.ColumnHasObject(nextColumn) && !allowStacking, () => - { - if (convertType.HasFlag(PatternType.Gathered)) - { - nextColumn++; - if (nextColumn == TotalColumns) - nextColumn = RandomStart; - } - else - nextColumn = Random.Next(RandomStart, TotalColumns); - }); + nextColumn = allowStacking + ? FindAvailableColumn(nextColumn, nextColumn: getNextColumn, patterns: pattern) + : FindAvailableColumn(nextColumn, nextColumn: getNextColumn, patterns: new[] { pattern, PreviousPattern }); addToPattern(pattern, nextColumn); } return pattern; + + int getNextColumn(int last) + { + if (convertType.HasFlag(PatternType.Gathered)) + { + last++; + if (last == TotalColumns) + last = RandomStart; + } + else + last = GetRandomColumn(); + return last; + } } /// @@ -292,13 +297,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int noteCount = getRandomNoteCountMirrored(centreProbability, p2, p3, out addToCentre); int columnLimit = (TotalColumns % 2 == 0 ? TotalColumns : TotalColumns - 1) / 2; - int nextColumn = Random.Next(RandomStart, columnLimit); + int nextColumn = GetRandomColumn(upperBound: columnLimit); for (int i = 0; i < noteCount; i++) { - RunWhile(() => pattern.ColumnHasObject(nextColumn), () => - { - nextColumn = Random.Next(RandomStart, columnLimit); - }); + nextColumn = FindAvailableColumn(nextColumn, upperBound: columnLimit, patterns: pattern); // Add normal note addToPattern(pattern, nextColumn); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs index 55081e5822..7a160ed389 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs @@ -3,6 +3,7 @@ using System; using System.Linq; +using JetBrains.Annotations; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.MathUtils; using osu.Game.Rulesets.Objects; @@ -90,6 +91,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy } private double? conversionDifficulty; + /// /// A difficulty factor used for various conversion methods from osu!stable. /// @@ -116,5 +118,82 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy return conversionDifficulty.Value; } } + + /// + /// Finds a new column in which a can be placed. + /// This uses to pick the next candidate column. + /// + /// The initial column to test. This may be returned if it is already a valid column. + /// A list of patterns for which the validity of a column should be checked against. + /// A column is not a valid candidate if a occupies the same column in any of the patterns. + /// A column for which there are no s in any of occupying the same column. + /// If there are no valid candidate columns. + protected int FindAvailableColumn(int initialColumn, params Pattern[] patterns) + => FindAvailableColumn(initialColumn, null, patterns: patterns); + + /// + /// Finds a new column in which a can be placed. + /// + /// The initial column to test. This may be returned if it is already a valid column. + /// A function to retrieve the next column. If null, a randomisation scheme will be used. + /// A function to perform additional validation checks to determine if a column is a valid candidate for a . + /// The minimum column index. If null, is used. + /// The maximum column index. If null, is used. + /// A list of patterns for which the validity of a column should be checked against. + /// A column is not a valid candidate if a occupies the same column in any of the patterns. + /// A column which has passed the check and for which there are no + /// s in any of occupying the same column. + /// If there are no valid candidate columns. + protected int FindAvailableColumn(int initialColumn, int? lowerBound = null, int? upperBound = null, Func nextColumn = null, [InstantHandle] Func validation = null, + params Pattern[] patterns) + { + lowerBound = lowerBound ?? RandomStart; + upperBound = upperBound ?? TotalColumns; + nextColumn = nextColumn ?? (_ => GetRandomColumn(lowerBound, upperBound)); + + // Check for the initial column + if (isValid(initialColumn)) + return initialColumn; + + // Ensure that we have at least one free column, so that an endless loop is avoided + bool hasValidColumns = false; + for (int i = lowerBound.Value; i < upperBound.Value; i++) + { + hasValidColumns = isValid(i); + if (hasValidColumns) + break; + } + + if (!hasValidColumns) + throw new NotEnoughColumnsException(); + + // Iterate until a valid column is found. This is a random iteration in the default case. + do + { + initialColumn = nextColumn(initialColumn); + } while (!isValid(initialColumn)); + + return initialColumn; + + bool isValid(int column) => validation?.Invoke(column) != false && !patterns.Any(p => p.ColumnHasObject(column)); + } + + /// + /// Returns a random column index in the range [RandomStart, TotalColumns). + /// + /// The minimum column index. If null, is used. + /// The maximum column index. If null, is used. + protected int GetRandomColumn(int? lowerBound = null, int? upperBound = null) => Random.Next(lowerBound ?? RandomStart, upperBound ?? TotalColumns); + + /// + /// Occurs when mania conversion is stuck in an infinite loop unable to find columns to place new hitobjects in. + /// + public class NotEnoughColumnsException : Exception + { + public NotEnoughColumnsException() + : base("There were not enough columns to complete conversion.") + { + } + } } } diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs index e51cbcdc60..a42d57cdd1 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs @@ -3,9 +3,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; -using JetBrains.Annotations; -using osu.Framework.Logging; using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns @@ -15,14 +12,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns /// internal abstract class PatternGenerator { - /// - /// An arbitrary maximum amount of iterations to perform in . - /// The specific value is not super important - enough such that no false-positives occur. - /// - /// /b/933228 requires at least 23 iterations. - /// - private const int max_rng_iterations = 30; - /// /// The last pattern. /// @@ -53,44 +42,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns TotalColumns = Beatmap.TotalColumns; } - protected void RunWhile([InstantHandle] Func condition, Action action) - { - int iterations = 0; - - while (condition()) - { - if (iterations++ >= max_rng_iterations) - { - // log an error but don't throw. we want to continue execution. - Logger.Error(new ExceededAllowedIterationsException(new StackTrace(0)), - "Conversion encountered errors. The beatmap may not be correctly converted."); - return; - } - - action(); - } - } - /// /// Generates the patterns for , each filled with hit objects. /// /// The s containing the hit objects. public abstract IEnumerable Generate(); - - /// - /// Denotes when a single conversion operation is in an infinitely looping state. - /// - public class ExceededAllowedIterationsException : Exception - { - private readonly string stackTrace; - - public ExceededAllowedIterationsException(StackTrace stackTrace) - { - this.stackTrace = stackTrace.ToString(); - } - - public override string StackTrace => stackTrace; - public override string ToString() => $"{GetType().Name}: {Message}\r\n{StackTrace}"; - } } } From 49913f00f09a0ee4d6e83e93b58e253a70c6b2fc Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Sat, 25 Aug 2018 00:07:48 +0900 Subject: [PATCH 117/136] Fix xmldoc --- .../Beatmaps/Patterns/Legacy/PatternGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs index 7a160ed389..05ca1d4365 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs @@ -179,7 +179,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy } /// - /// Returns a random column index in the range [RandomStart, TotalColumns). + /// Returns a random column index in the range [, ). /// /// The minimum column index. If null, is used. /// The maximum column index. If null, is used. From 8204d3292eb607d6c55e21244ed53e13361865a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 25 Aug 2018 14:50:46 +0900 Subject: [PATCH 118/136] Log to correct file --- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index d2be36e991..774a80049b 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -352,7 +352,7 @@ namespace osu.Game.Beatmaps string mapName = reader.Filenames.FirstOrDefault(f => f.EndsWith(".osu")); if (string.IsNullOrEmpty(mapName)) { - Logger.Log($"No beatmap files found in the beatmap archive ({reader.Name})."); + Logger.Log($"No beatmap files found in the beatmap archive ({reader.Name}).", LoggingTarget.Database); return null; } From 5c7ff31675aa4e50f43469f7018b4a346984dd98 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 25 Aug 2018 14:51:42 +0900 Subject: [PATCH 119/136] Add note about null return --- osu.Game/Database/ArchiveModelManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 42dd6684d5..326d042c39 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -390,7 +390,7 @@ namespace osu.Game.Database /// Actual expensive population should be done in ; this should just prepare for duplicate checking. /// /// The archive to create the model for. - /// A model populated with minimal information. + /// A model populated with minimal information. Returning a null will abort importing silently. protected abstract TModel CreateModel(ArchiveReader archive); /// From 21d5322899deede2d49e8327d1b13ae0a98e4dfa Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 27 Aug 2018 17:05:58 +0900 Subject: [PATCH 120/136] Update with async changes --- osu.Game/Graphics/Sprites/OsuSpriteText.cs | 2 +- osu.Game/IO/Archives/ArchiveReader.cs | 7 +++++-- osu.Game/Skinning/LegacySkin.cs | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/Sprites/OsuSpriteText.cs b/osu.Game/Graphics/Sprites/OsuSpriteText.cs index c9389bb9e2..12b816184e 100644 --- a/osu.Game/Graphics/Sprites/OsuSpriteText.cs +++ b/osu.Game/Graphics/Sprites/OsuSpriteText.cs @@ -22,7 +22,7 @@ namespace osu.Game.Graphics.Sprites protected override Drawable CreateFallbackCharacterDrawable() { - var tex = GetTextureForCharacter('?'); + var tex = GetTextureForCharacter('?').Result; if (tex != null) { diff --git a/osu.Game/IO/Archives/ArchiveReader.cs b/osu.Game/IO/Archives/ArchiveReader.cs index 808ce159bb..24a5094586 100644 --- a/osu.Game/IO/Archives/ArchiveReader.cs +++ b/osu.Game/IO/Archives/ArchiveReader.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; +using System.Threading.Tasks; using osu.Framework.IO.Stores; namespace osu.Game.IO.Archives @@ -28,7 +29,9 @@ namespace osu.Game.IO.Archives public abstract IEnumerable Filenames { get; } - public virtual byte[] Get(string name) + public virtual byte[] Get(string name) => GetAsync(name).Result; + + public async Task GetAsync(string name) { using (Stream input = GetStream(name)) { @@ -36,7 +39,7 @@ namespace osu.Game.IO.Archives return null; byte[] buffer = new byte[input.Length]; - input.Read(buffer, 0, buffer.Length); + await input.ReadAsync(buffer, 0, buffer.Length); return buffer; } } diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index 45c6ec80aa..f9801c2f92 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -4,6 +4,7 @@ using System; using System.IO; using System.Linq; +using System.Threading.Tasks; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics; @@ -108,10 +109,12 @@ namespace osu.Game.Skinning return path == null ? null : underlyingStore.GetStream(path); } - byte[] IResourceStore.Get(string name) + byte[] IResourceStore.Get(string name) => GetAsync(name).Result; + + public async Task GetAsync(string name) { string path = getPathForFile(name); - return path == null ? null : underlyingStore.Get(path); + return path == null ? null : await underlyingStore.GetAsync(path); } #region IDisposable Support From 1b279d383f4e513c8b401b75402daf6ab3e8e604 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 27 Aug 2018 17:26:44 +0900 Subject: [PATCH 121/136] Use GetAsync on all textures --- osu.Desktop/Overlays/VersionManager.cs | 5 +++-- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 5 +++-- .../Objects/Drawables/Pieces/DefaultCirclePiece.cs | 5 +++-- osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs | 5 +++-- osu.Game.Rulesets.Taiko/UI/InputDrum.cs | 11 ++++++----- osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs | 5 +++-- osu.Game/Graphics/Backgrounds/Background.cs | 5 +++-- osu.Game/Graphics/Cursor/MenuCursor.cs | 7 ++++--- osu.Game/Overlays/MedalOverlay.cs | 5 +++-- osu.Game/Overlays/MedalSplash/DrawableMedal.cs | 7 ++++--- osu.Game/Overlays/MusicController.cs | 4 ++-- osu.Game/Overlays/Profile/Components/GradeBadge.cs | 5 +++-- osu.Game/Overlays/Profile/Header/BadgeContainer.cs | 5 +++-- osu.Game/Overlays/Profile/ProfileHeader.cs | 5 +++-- .../Overlays/Profile/Sections/Recent/MedalIcon.cs | 5 +++-- .../Screens/Backgrounds/BackgroundScreenBeatmap.cs | 5 +++-- osu.Game/Screens/Menu/OsuLogo.cs | 7 ++++--- osu.Game/Screens/Play/KeyCounter.cs | 7 ++++--- osu.Game/Screens/Ranking/ResultsPageScore.cs | 5 +++-- osu.Game/Screens/Select/Leaderboards/DrawableRank.cs | 9 +++++---- .../Tournament/Components/VisualiserContainer.cs | 5 +++-- osu.Game/Screens/Tournament/Drawings.cs | 4 ++-- osu.Game/Screens/Tournament/Group.cs | 5 +++-- osu.Game/Screens/Tournament/ScrollingTeamContainer.cs | 5 +++-- osu.Game/Users/Avatar.cs | 7 ++++--- osu.Game/Users/Country.cs | 9 +++++---- osu.Game/Users/UserCoverBackground.cs | 5 +++-- osu.Game/osu.Game.csproj | 2 +- 28 files changed, 92 insertions(+), 67 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 1129969694..740ad7c3be 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -31,7 +32,7 @@ namespace osu.Desktop.Overlays public override bool HandleMouseInput => false; [BackgroundDependencyLoader] - private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host) + private async Task load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host) { notificationOverlay = notification; this.config = config; @@ -86,7 +87,7 @@ namespace osu.Desktop.Overlays { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Texture = textures.Get(@"Menu/dev-build-footer"), + Texture = await textures.GetAsync(@"Menu/dev-build-footer"), }, } } diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 4327abb96f..99d902d3e4 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -3,6 +3,7 @@ using System; using System.Linq; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -448,9 +449,9 @@ namespace osu.Game.Rulesets.Catch.UI } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { - Texture = textures.Get(@"Play/Catch/fruit-catcher-idle"); + Texture = await textures.GetAsync(@"Play/Catch/fruit-catcher-idle"); } } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/DefaultCirclePiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/DefaultCirclePiece.cs index 86b60c3443..c7c81756eb 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/DefaultCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/DefaultCirclePiece.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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.Graphics; using osu.Framework.Graphics.Containers; @@ -12,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public class DefaultCirclePiece : Container { [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { RelativeSizeAxes = Axes.Both; Children = new Drawable[] @@ -21,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Texture = textures.Get(@"Play/osu/disc"), + Texture = await textures.GetAsync(@"Play/osu/disc"), }, new TrianglesPiece { diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index abcd1ddbda..4b981dc406 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -4,6 +4,7 @@ using System; using System.Diagnostics; using System.Runtime.InteropServices; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.OpenGL.Buffers; @@ -79,10 +80,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; [BackgroundDependencyLoader] - private void load(ShaderManager shaders, TextureStore textures) + private async Task load(ShaderManager shaders, TextureStore textures) { shader = shaders?.Load(@"CursorTrail", FragmentShaderDescriptor.TEXTURE); - texture = textures.Get(@"Cursor/cursortrail"); + texture = await textures.GetAsync(@"Cursor/cursortrail"); Scale = new Vector2(1 / texture.ScaleAdjust); } diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs index 524535bfde..f525ce0ff3 100644 --- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Threading.Tasks; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -130,12 +131,12 @@ namespace osu.Game.Rulesets.Taiko.UI } [BackgroundDependencyLoader] - private void load(TextureStore textures, OsuColour colours) + private async Task load(TextureStore textures, OsuColour colours) { - rim.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer"); - rimHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer-hit"); - centre.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner"); - centreHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner-hit"); + rim.Texture = await textures.GetAsync(@"Play/Taiko/taiko-drum-outer"); + rimHit.Texture = await textures.GetAsync(@"Play/Taiko/taiko-drum-outer-hit"); + centre.Texture = await textures.GetAsync(@"Play/Taiko/taiko-drum-inner"); + centreHit.Texture = await textures.GetAsync(@"Play/Taiko/taiko-drum-inner-hit"); rimHit.Colour = colours.Blue; centreHit.Colour = colours.Pink; diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs index 883c05f1e4..9bba589f59 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; @@ -23,7 +24,7 @@ namespace osu.Game.Beatmaps.Drawables } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { string resource = null; @@ -41,7 +42,7 @@ namespace osu.Game.Beatmaps.Drawables } if (resource != null) - Texture = textures.Get(resource); + Texture = await textures.GetAsync(resource); } } diff --git a/osu.Game/Graphics/Backgrounds/Background.cs b/osu.Game/Graphics/Backgrounds/Background.cs index d5825a8c42..dcd1db56de 100644 --- a/osu.Game/Graphics/Backgrounds/Background.cs +++ b/osu.Game/Graphics/Backgrounds/Background.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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.Graphics; using osu.Framework.Graphics.Containers; @@ -34,10 +35,10 @@ namespace osu.Game.Graphics.Backgrounds } [BackgroundDependencyLoader] - private void load(LargeTextureStore textures) + private async Task load(LargeTextureStore textures) { if (!string.IsNullOrEmpty(textureName)) - Sprite.Texture = textures.Get(textureName); + Sprite.Texture = await textures.GetAsync(textureName); } } } diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index b55e1aa5dd..92b45ebcb9 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; using System; +using System.Threading.Tasks; using JetBrains.Annotations; using osu.Framework.Graphics.Textures; using osu.Framework.Input.EventArgs; @@ -132,7 +133,7 @@ namespace osu.Game.Graphics.Cursor } [BackgroundDependencyLoader] - private void load(OsuConfigManager config, TextureStore textures, OsuColour colour) + private async Task load(OsuConfigManager config, TextureStore textures, OsuColour colour) { Children = new Drawable[] { @@ -143,14 +144,14 @@ namespace osu.Game.Graphics.Cursor { new Sprite { - Texture = textures.Get(@"Cursor/menu-cursor"), + Texture = await textures.GetAsync(@"Cursor/menu-cursor"), }, AdditiveLayer = new Sprite { Blending = BlendingMode.Additive, Colour = colour.Pink, Alpha = 0, - Texture = textures.Get(@"Cursor/menu-cursor-additive"), + Texture = await textures.GetAsync(@"Cursor/menu-cursor-additive"), }, } } diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index bd67a718a7..2ff0524880 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -20,6 +20,7 @@ using OpenTK.Input; using osu.Framework.Graphics.Shapes; using System; using System.Linq; +using System.Threading.Tasks; using osu.Framework.Input.States; using osu.Framework.MathUtils; @@ -143,10 +144,10 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(OsuColour colours, TextureStore textures, AudioManager audio) + private async Task load(OsuColour colours, TextureStore textures, AudioManager audio) { getSample = audio.Sample.Get(@"MedalSplash/medal-get"); - innerSpin.Texture = outerSpin.Texture = textures.Get(@"MedalSplash/disc-spin"); + innerSpin.Texture = outerSpin.Texture = await textures.GetAsync(@"MedalSplash/disc-spin"); disc.EdgeEffect = leftStrip.EdgeEffect = rightStrip.EdgeEffect = new EdgeEffectParameters { diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index a27278e002..9ced6520df 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Threading.Tasks; using osu.Framework; using OpenTK; using osu.Framework.Allocation; @@ -118,10 +119,10 @@ namespace osu.Game.Overlays.MedalSplash } [BackgroundDependencyLoader] - private void load(OsuColour colours, TextureStore textures) + private async Task load(OsuColour colours, TextureStore textures) { - medalSprite.Texture = textures.Get(medal.ImageUrl); - medalGlow.Texture = textures.Get(@"MedalSplash/medal-glow"); + medalSprite.Texture = await textures.GetAsync(medal.ImageUrl); + medalGlow.Texture = await textures.GetAsync(@"MedalSplash/medal-glow"); description.Colour = colours.BlueLight; } diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 886b5fb95b..42f89a4863 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -454,9 +454,9 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { - sprite.Texture = beatmap?.Background ?? textures.Get(@"Backgrounds/bg4"); + sprite.Texture = beatmap?.Background ?? await textures.GetAsync(@"Backgrounds/bg4"); } } diff --git a/osu.Game/Overlays/Profile/Components/GradeBadge.cs b/osu.Game/Overlays/Profile/Components/GradeBadge.cs index 14a47e8d03..3943a5f86b 100644 --- a/osu.Game/Overlays/Profile/Components/GradeBadge.cs +++ b/osu.Game/Overlays/Profile/Components/GradeBadge.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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.Graphics; using osu.Framework.Graphics.Containers; @@ -42,9 +43,9 @@ namespace osu.Game.Overlays.Profile.Components } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { - badge.Texture = textures.Get($"Grades/{grade}"); + badge.Texture = await textures.GetAsync($"Grades/{grade}"); } } } diff --git a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs index bfade5e45c..f87aefb28a 100644 --- a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs +++ b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -176,13 +177,13 @@ namespace osu.Game.Overlays.Profile.Header } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { Child = new Sprite { FillMode = FillMode.Fit, RelativeSizeAxes = Axes.Both, - Texture = textures.Get(badge.ImageUrl), + Texture = await textures.GetAsync(badge.ImageUrl), }; } diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 9d09836d25..48048d2935 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Threading.Tasks; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -311,9 +312,9 @@ namespace osu.Game.Overlays.Profile } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { - levelBadge.Texture = textures.Get(@"Profile/levelbadge"); + levelBadge.Texture = await textures.GetAsync(@"Profile/levelbadge"); } private User user; diff --git a/osu.Game/Overlays/Profile/Sections/Recent/MedalIcon.cs b/osu.Game/Overlays/Profile/Sections/Recent/MedalIcon.cs index 0d354c728f..2eec75c875 100644 --- a/osu.Game/Overlays/Profile/Sections/Recent/MedalIcon.cs +++ b/osu.Game/Overlays/Profile/Sections/Recent/MedalIcon.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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.Graphics.Containers; using osu.Framework.Graphics; @@ -30,9 +31,9 @@ namespace osu.Game.Overlays.Profile.Sections.Recent } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { - sprite.Texture = textures.Get(url); + sprite.Texture = await textures.GetAsync(url); } } } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 78561cecbf..14d4cab870 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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.Graphics; using osu.Framework.Graphics.Textures; @@ -75,9 +76,9 @@ namespace osu.Game.Screens.Backgrounds } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { - Sprite.Texture = beatmap?.Background ?? textures.Get(@"Backgrounds/bg1"); + Sprite.Texture = beatmap?.Background ?? await textures.GetAsync(@"Backgrounds/bg1"); } } } diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index f0f765a4c9..fde32b31fd 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -253,13 +254,13 @@ namespace osu.Game.Screens.Menu } [BackgroundDependencyLoader] - private void load(TextureStore textures, AudioManager audio) + private async Task load(TextureStore textures, AudioManager audio) { sampleClick = audio.Sample.Get(@"Menu/osu-logo-select"); sampleBeat = audio.Sample.Get(@"Menu/osu-logo-heartbeat"); - logo.Texture = textures.Get(@"Menu/logo"); - ripple.Texture = textures.Get(@"Menu/logo"); + logo.Texture = await textures.GetAsync(@"Menu/logo"); + ripple.Texture = await textures.GetAsync(@"Menu/logo"); } private int lastBeatIndex; diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 2c31e61114..49500a8426 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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.Graphics; using osu.Framework.Graphics.Containers; @@ -61,19 +62,19 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { Children = new Drawable[] { buttonSprite = new Sprite { - Texture = textures.Get(@"KeyCounter/key-up"), + Texture = await textures.GetAsync(@"KeyCounter/key-up"), Anchor = Anchor.Centre, Origin = Anchor.Centre, }, glowSprite = new Sprite { - Texture = textures.Get(@"KeyCounter/key-glow"), + Texture = await textures.GetAsync(@"KeyCounter/key-glow"), Anchor = Anchor.Centre, Origin = Anchor.Centre, Alpha = 0 diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 42d8af07b9..87e53b8182 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -368,10 +369,10 @@ namespace osu.Game.Screens.Ranking } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { if (!string.IsNullOrEmpty(user.CoverUrl)) - cover.Texture = textures.Get(user.CoverUrl); + cover.Texture = await textures.GetAsync(user.CoverUrl); } } diff --git a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs index 0c4b369f36..f5f9ebbdaf 100644 --- a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs +++ b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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.Graphics; using osu.Framework.Graphics.Containers; @@ -35,20 +36,20 @@ namespace osu.Game.Screens.Select.Leaderboards } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { this.textures = textures; - updateTexture(); + await updateTexture(); } - private void updateTexture() => rankSprite.Texture = textures.Get($@"Grades/{Rank.GetDescription()}"); + private async Task updateTexture() => rankSprite.Texture = await textures.GetAsync($@"Grades/{Rank.GetDescription()}"); public void UpdateRank(ScoreRank newRank) { Rank = newRank; if (LoadState >= LoadState.Ready) - updateTexture(); + updateTexture().Wait(); } } } diff --git a/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs b/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs index 1453d4e78f..835b0757e0 100644 --- a/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs +++ b/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics.Textures; using osu.Framework.MathUtils; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; namespace osu.Game.Screens.Tournament.Components { @@ -75,9 +76,9 @@ namespace osu.Game.Screens.Tournament.Components private int expiredCount; [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { - texture = textures.Get("Drawings/visualiser-line"); + texture = await textures.GetAsync("Drawings/visualiser-line"); } protected override void UpdateAfterChildren() diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 63d29d5cd7..20180a660f 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Tournament dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); [BackgroundDependencyLoader] - private void load(TextureStore textures, Storage storage) + private async Task load(TextureStore textures, Storage storage) { this.storage = storage; @@ -87,7 +87,7 @@ namespace osu.Game.Screens.Tournament { RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, - Texture = textures.Get(@"Backgrounds/Drawings/background.png") + Texture = await textures.GetAsync(@"Backgrounds/Drawings/background.png") }, new FillFlowContainer { diff --git a/osu.Game/Screens/Tournament/Group.cs b/osu.Game/Screens/Tournament/Group.cs index 6845d8fc48..5128166c15 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game/Screens/Tournament/Group.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -178,9 +179,9 @@ namespace osu.Game.Screens.Tournament } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { - flagSprite.Texture = textures.Get($@"Flags/{Team.FlagName}"); + flagSprite.Texture = await textures.GetAsync($@"Flags/{Team.FlagName}"); } } } diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index d1c7e0fced..cc9f805c62 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -372,9 +373,9 @@ namespace osu.Game.Screens.Tournament } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { - flagSprite.Texture = textures.Get($@"Flags/{Team.FlagName}"); + flagSprite.Texture = await textures.GetAsync($@"Flags/{Team.FlagName}"); } } } diff --git a/osu.Game/Users/Avatar.cs b/osu.Game/Users/Avatar.cs index 9ba9549164..9aac662a84 100644 --- a/osu.Game/Users/Avatar.cs +++ b/osu.Game/Users/Avatar.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -24,14 +25,14 @@ namespace osu.Game.Users } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { if (textures == null) throw new ArgumentNullException(nameof(textures)); Texture texture = null; - if (user != null && user.Id > 1) texture = textures.Get($@"https://a.ppy.sh/{user.Id}"); - if (texture == null) texture = textures.Get(@"Online/avatar-guest"); + if (user != null && user.Id > 1) texture = await textures.GetAsync($@"https://a.ppy.sh/{user.Id}"); + if (texture == null) texture = await textures.GetAsync(@"Online/avatar-guest"); Add(new Sprite { diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index 80039eadad..a37ca10f9a 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Threading.Tasks; using Newtonsoft.Json; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -44,7 +45,7 @@ namespace osu.Game.Users country = value; if (LoadState >= LoadState.Ready) - sprite.Texture = getFlagTexture(); + sprite.Texture = getFlagTexture().Result; } } @@ -64,15 +65,15 @@ namespace osu.Game.Users } [BackgroundDependencyLoader] - private void load(TextureStore ts) + private async Task load(TextureStore ts) { if (ts == null) throw new ArgumentNullException(nameof(ts)); textures = ts; - sprite.Texture = getFlagTexture(); + sprite.Texture = await getFlagTexture(); } - private Texture getFlagTexture() => textures.Get($@"Flags/{country?.FlagName ?? @"__"}"); + private async Task getFlagTexture() => await textures.GetAsync($@"Flags/{country?.FlagName ?? @"__"}"); } } diff --git a/osu.Game/Users/UserCoverBackground.cs b/osu.Game/Users/UserCoverBackground.cs index 58b92b2750..97d2648e07 100644 --- a/osu.Game/Users/UserCoverBackground.cs +++ b/osu.Game/Users/UserCoverBackground.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; @@ -18,13 +19,13 @@ namespace osu.Game.Users } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private async Task load(TextureStore textures) { if (textures == null) throw new ArgumentNullException(nameof(textures)); if (!string.IsNullOrEmpty(user.CoverUrl)) - Texture = textures.Get(user.CoverUrl); + Texture = await textures.GetAsync(user.CoverUrl); } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 69d242daa9..fce7cb73a2 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From e7a5816d27a63dcabed1a6f6cc7e6fd49ad95a86 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 27 Aug 2018 17:30:16 +0900 Subject: [PATCH 122/136] Use GetAsync for all samples --- osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs | 7 ++++--- osu.Game/Graphics/ScreenshotManager.cs | 4 ++-- osu.Game/Graphics/UserInterface/HoverClickSounds.cs | 5 +++-- osu.Game/Graphics/UserInterface/HoverSounds.cs | 5 +++-- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 7 ++++--- osu.Game/Graphics/UserInterface/OsuMenu.cs | 7 ++++--- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 5 +++-- osu.Game/Overlays/MedalOverlay.cs | 2 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 7 ++++--- osu.Game/Screens/Menu/Button.cs | 7 ++++--- osu.Game/Screens/Menu/ButtonSystem.cs | 5 +++-- osu.Game/Screens/Menu/Intro.cs | 7 ++++--- osu.Game/Screens/Menu/OsuLogo.cs | 4 ++-- osu.Game/Screens/OsuScreen.cs | 5 +++-- osu.Game/Screens/Play/Player.cs | 4 ++-- osu.Game/Screens/Play/SkipOverlay.cs | 5 +++-- osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs | 5 +++-- osu.Game/Screens/Select/PlaySongSelect.cs | 4 ++-- osu.Game/Screens/Select/SongSelect.cs | 7 ++++--- 19 files changed, 58 insertions(+), 44 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index d2ab8441eb..effcc696ca 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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; @@ -37,15 +38,15 @@ namespace osu.Game.Graphics.Containers } [BackgroundDependencyLoader(true)] - private void load(OsuGame osuGame, AudioManager audio, PreviewTrackManager previewTrackManager) + private async Task load(OsuGame osuGame, AudioManager audio, PreviewTrackManager previewTrackManager) { this.previewTrackManager = previewTrackManager; if (osuGame != null) OverlayActivationMode.BindTo(osuGame.OverlayActivationMode); - samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in"); - samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out"); + samplePopIn = await audio.Sample.GetAsync(@"UI/overlay-pop-in"); + samplePopOut = await audio.Sample.GetAsync(@"UI/overlay-pop-out"); StateChanged += onStateChanged; } diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index bc30794298..63b97e3c59 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -42,7 +42,7 @@ namespace osu.Game.Graphics private SampleChannel shutter; [BackgroundDependencyLoader] - private void load(GameHost host, OsuConfigManager config, Storage storage, NotificationOverlay notificationOverlay, AudioManager audio) + private async Task load(GameHost host, OsuConfigManager config, Storage storage, NotificationOverlay notificationOverlay, AudioManager audio) { this.host = host; this.storage = storage.GetStorageForDirectory(@"screenshots"); @@ -51,7 +51,7 @@ namespace osu.Game.Graphics screenshotFormat = config.GetBindable(OsuSetting.ScreenshotFormat); captureMenuCursor = config.GetBindable(OsuSetting.ScreenshotCaptureMenuCursor); - shutter = audio.Sample.Get("UI/shutter"); + shutter = await audio.Sample.GetAsync("UI/shutter"); } public bool OnPressed(GlobalAction action) diff --git a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs index 27a06ba0b7..17924cdbb8 100644 --- a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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; @@ -28,9 +29,9 @@ namespace osu.Game.Graphics.UserInterface } [BackgroundDependencyLoader] - private void load(AudioManager audio) + private async Task load(AudioManager audio) { - sampleClick = audio.Sample.Get($@"UI/generic-select{SampleSet.GetDescription()}"); + sampleClick = await audio.Sample.GetAsync($@"UI/generic-select{SampleSet.GetDescription()}"); } } } diff --git a/osu.Game/Graphics/UserInterface/HoverSounds.cs b/osu.Game/Graphics/UserInterface/HoverSounds.cs index 821305bc92..b3a83d1cc8 100644 --- a/osu.Game/Graphics/UserInterface/HoverSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverSounds.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.ComponentModel; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -35,9 +36,9 @@ namespace osu.Game.Graphics.UserInterface } [BackgroundDependencyLoader] - private void load(AudioManager audio) + private async Task load(AudioManager audio) { - sampleHover = audio.Sample.Get($@"UI/generic-hover{SampleSet.GetDescription()}"); + sampleHover = await audio.Sample.GetAsync($@"UI/generic-hover{SampleSet.GetDescription()}"); } } diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 68f59bd8cd..d6b4b51851 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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; @@ -110,10 +111,10 @@ namespace osu.Game.Graphics.UserInterface } [BackgroundDependencyLoader] - private void load(AudioManager audio) + private async Task load(AudioManager audio) { - sampleChecked = audio.Sample.Get(@"UI/check-on"); - sampleUnchecked = audio.Sample.Get(@"UI/check-off"); + sampleChecked = await audio.Sample.GetAsync(@"UI/check-on"); + sampleUnchecked = await audio.Sample.GetAsync(@"UI/check-off"); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index abb077e94f..b5ebac0c74 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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; @@ -69,10 +70,10 @@ namespace osu.Game.Graphics.UserInterface } [BackgroundDependencyLoader] - private void load(AudioManager audio) + private async Task load(AudioManager audio) { - sampleHover = audio.Sample.Get(@"UI/generic-hover"); - sampleClick = audio.Sample.Get(@"UI/generic-select"); + sampleHover = await audio.Sample.GetAsync(@"UI/generic-hover"); + sampleClick = await audio.Sample.GetAsync(@"UI/generic-select"); BackgroundColour = Color4.Transparent; BackgroundColourHover = OsuColour.FromHex(@"172023"); diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index b7b5319e06..cd0b3dcad2 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; +using System.Threading.Tasks; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -119,9 +120,9 @@ namespace osu.Game.Graphics.UserInterface } [BackgroundDependencyLoader] - private void load(AudioManager audio, OsuColour colours) + private async Task load(AudioManager audio, OsuColour colours) { - sample = audio.Sample.Get(@"UI/sliderbar-notch"); + sample = await audio.Sample.GetAsync(@"UI/sliderbar-notch"); AccentColour = colours.Pink; } diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 2ff0524880..038fa936b0 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -146,7 +146,7 @@ namespace osu.Game.Overlays [BackgroundDependencyLoader] private async Task load(OsuColour colours, TextureStore textures, AudioManager audio) { - getSample = audio.Sample.Get(@"MedalSplash/medal-get"); + getSample = await audio.Sample.GetAsync(@"MedalSplash/medal-get"); innerSpin.Texture = outerSpin.Texture = await textures.GetAsync(@"MedalSplash/disc-spin"); disc.EdgeEffect = leftStrip.EdgeEffect = rightStrip.EdgeEffect = new EdgeEffectParameters diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index e83dedaf35..783fcfa090 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -15,6 +15,7 @@ using osu.Game.Rulesets.Mods; using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics.Shapes; @@ -49,7 +50,7 @@ namespace osu.Game.Overlays.Mods protected readonly IBindable Ruleset = new Bindable(); [BackgroundDependencyLoader(true)] - private void load(OsuColour colours, IBindable ruleset, AudioManager audio, Bindable> selectedMods) + private async Task load(OsuColour colours, IBindable ruleset, AudioManager audio, Bindable> selectedMods) { LowMultiplierColour = colours.Red; HighMultiplierColour = colours.Green; @@ -58,8 +59,8 @@ namespace osu.Game.Overlays.Mods Ruleset.BindTo(ruleset); if (selectedMods != null) SelectedMods.BindTo(selectedMods); - sampleOn = audio.Sample.Get(@"UI/check-on"); - sampleOff = audio.Sample.Get(@"UI/check-off"); + sampleOn = await audio.Sample.GetAsync(@"UI/check-on"); + sampleOff = await audio.Sample.GetAsync(@"UI/check-off"); } protected override void LoadComplete() diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index e53905a102..3593568578 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Threading.Tasks; using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -179,11 +180,11 @@ namespace osu.Game.Screens.Menu } [BackgroundDependencyLoader] - private void load(AudioManager audio) + private async Task load(AudioManager audio) { - sampleHover = audio.Sample.Get(@"Menu/button-hover"); + sampleHover = await audio.Sample.GetAsync(@"Menu/button-hover"); if (!string.IsNullOrEmpty(sampleName)) - sampleClick = audio.Sample.Get($@"Menu/{sampleName}"); + sampleClick = await audio.Sample.GetAsync($@"Menu/{sampleName}"); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index b9a799328e..4137028527 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -102,10 +103,10 @@ namespace osu.Game.Screens.Menu private OsuGame game; [BackgroundDependencyLoader(true)] - private void load(AudioManager audio, OsuGame game) + private async Task load(AudioManager audio, OsuGame game) { this.game = game; - sampleBack = audio.Sample.Get(@"Menu/button-back-select"); + sampleBack = await audio.Sample.GetAsync(@"Menu/button-back-select"); } public bool OnPressed(GlobalAction action) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index c1032011f7..5d39d70e26 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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; @@ -47,7 +48,7 @@ namespace osu.Game.Screens.Menu private WorkingBeatmap introBeatmap; [BackgroundDependencyLoader] - private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap) + private async Task load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap) { this.beatmap.BindTo(beatmap); @@ -80,8 +81,8 @@ namespace osu.Game.Screens.Menu introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); track = introBeatmap.Track; - welcome = audio.Sample.Get(@"welcome"); - seeya = audio.Sample.Get(@"seeya"); + welcome = await audio.Sample.GetAsync(@"welcome"); + seeya = await audio.Sample.GetAsync(@"seeya"); } private const double delay_step_one = 2300; diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index fde32b31fd..c6cfd9ba2d 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -256,8 +256,8 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader] private async Task load(TextureStore textures, AudioManager audio) { - sampleClick = audio.Sample.Get(@"Menu/osu-logo-select"); - sampleBeat = audio.Sample.Get(@"Menu/osu-logo-heartbeat"); + sampleClick = await audio.Sample.GetAsync(@"Menu/osu-logo-select"); + sampleBeat = await audio.Sample.GetAsync(@"Menu/osu-logo-heartbeat"); logo.Texture = await textures.GetAsync(@"Menu/logo"); ripple.Texture = await textures.GetAsync(@"Menu/logo"); diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 4b893f0118..3929e631cf 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Threading.Tasks; using Microsoft.EntityFrameworkCore.Internal; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -80,7 +81,7 @@ namespace osu.Game.Screens private SampleChannel sampleExit; [BackgroundDependencyLoader(true)] - private void load(BindableBeatmap beatmap, OsuGame osu, AudioManager audio, Bindable ruleset) + private async Task load(BindableBeatmap beatmap, OsuGame osu, AudioManager audio, Bindable ruleset) { Beatmap.BindTo(beatmap); Ruleset.BindTo(ruleset); @@ -98,7 +99,7 @@ namespace osu.Game.Screens }; } - sampleExit = audio.Sample.Get(@"UI/screen-back"); + sampleExit = await audio.Sample.GetAsync(@"UI/screen-back"); } public virtual bool OnPressed(GlobalAction action) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 5ad0130fd7..863d12c1c2 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -84,7 +84,7 @@ namespace osu.Game.Screens.Play public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true; [BackgroundDependencyLoader] - private void load(AudioManager audio, APIAccess api, OsuConfigManager config) + private async Task load(AudioManager audio, APIAccess api, OsuConfigManager config) { this.api = api; @@ -92,7 +92,7 @@ namespace osu.Game.Screens.Play if (working is DummyWorkingBeatmap) return; - sampleRestart = audio.Sample.Get(@"Gameplay/restart"); + sampleRestart = await audio.Sample.GetAsync(@"Gameplay/restart"); mouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); userAudioOffset = config.GetBindable(OsuSetting.AudioOffset); diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index 06837c9274..9aaaa6152c 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Threading.Tasks; using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -224,12 +225,12 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader] - private void load(OsuColour colours, AudioManager audio) + private async Task load(OsuColour colours, AudioManager audio) { colourNormal = colours.Yellow; colourHover = colours.YellowDark; - sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection"); + sampleConfirm = await audio.Sample.GetAsync(@"SongSelect/confirm-selection"); Children = new Drawable[] { diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs index 8a0052559e..b252f116ac 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 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; @@ -45,7 +46,7 @@ namespace osu.Game.Screens.Select.Carousel private SampleChannel sampleHover; [BackgroundDependencyLoader] - private void load(AudioManager audio, OsuColour colours) + private async Task load(AudioManager audio, OsuColour colours) { InternalChild = borderContainer = new Container { @@ -68,7 +69,7 @@ namespace osu.Game.Screens.Select.Carousel } }; - sampleHover = audio.Sample.Get($@"SongSelect/song-ping-variation-{RNG.Next(1, 5)}"); + sampleHover = await audio.Sample.GetAsync($@"SongSelect/song-ping-variation-{RNG.Next(1, 5)}"); hoverLayer.Colour = colours.Blue.Opacity(0.1f); } diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index e914eb365e..cab7bdfe73 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -55,11 +55,11 @@ namespace osu.Game.Screens.Select private readonly Bindable> selectedMods = new Bindable>(new Mod[] { }); [BackgroundDependencyLoader(true)] - private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, Bindable> selectedMods) + private async Task load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, Bindable> selectedMods) { if (selectedMods != null) this.selectedMods.BindTo(selectedMods); - sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection"); + sampleConfirm = await audio.Sample.GetAsync(@"SongSelect/confirm-selection"); Footer.AddButton(@"mods", colours.Yellow, modSelect, Key.F1, float.MaxValue); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index dcc0760262..ef03aff107 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -3,6 +3,7 @@ using System; using System.Linq; +using System.Threading.Tasks; using OpenTK; using OpenTK.Input; using osu.Framework.Allocation; @@ -198,7 +199,7 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader(true)] - private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours) + private async Task load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours) { if (Footer != null) { @@ -218,8 +219,8 @@ namespace osu.Game.Screens.Select dialogOverlay = dialog; - sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty"); - sampleChangeBeatmap = audio.Sample.Get(@"SongSelect/select-expand"); + sampleChangeDifficulty = await audio.Sample.GetAsync(@"SongSelect/select-difficulty"); + sampleChangeBeatmap = await audio.Sample.GetAsync(@"SongSelect/select-expand"); Carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSetsEnumerable(); } From da2f04c79c3c6f5bb1b4543a3200e6e8eea65351 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 28 Aug 2018 16:07:52 +0900 Subject: [PATCH 123/136] Update framework once more --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index fce7cb73a2..0633d7913e 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 919e78a89ac6e7cbb8d1e23e175fd489ba7ce106 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Aug 2018 01:42:25 +0900 Subject: [PATCH 124/136] Attempt to fix cross-thread database usage --- osu.Game/Screens/Select/BeatmapCarousel.cs | 50 ++++++++++++---------- osu.Game/Screens/Select/SongSelect.cs | 2 +- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 6e4454a311..7bb0b95b9a 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -64,32 +64,36 @@ namespace osu.Game.Screens.Select public IEnumerable BeatmapSets { - get { return beatmapSets.Select(g => g.BeatmapSet); } - set + get => beatmapSets.Select(g => g.BeatmapSet); + set => loadBeatmapSets(() => value); + } + + public void LoadBeatmapSetsFromManager(BeatmapManager manager) => loadBeatmapSets(manager.GetAllUsableBeatmapSetsEnumerable); + + private void loadBeatmapSets(Func> beatmapSets) + { + CarouselRoot newRoot = new CarouselRoot(this); + + Task.Run(() => { - CarouselRoot newRoot = new CarouselRoot(this); + beatmapSets().Select(createCarouselSet).Where(g => g != null).ForEach(newRoot.AddChild); + newRoot.Filter(activeCriteria); - Task.Run(() => + // preload drawables as the ctor overhead is quite high currently. + var _ = newRoot.Drawables; + }).ContinueWith(_ => Schedule(() => + { + root = newRoot; + scrollableContent.Clear(false); + itemsCache.Invalidate(); + scrollPositionCache.Invalidate(); + + Schedule(() => { - value.Select(createCarouselSet).Where(g => g != null).ForEach(newRoot.AddChild); - newRoot.Filter(activeCriteria); - - // preload drawables as the ctor overhead is quite high currently. - var _ = newRoot.Drawables; - }).ContinueWith(_ => Schedule(() => - { - root = newRoot; - scrollableContent.Clear(false); - itemsCache.Invalidate(); - scrollPositionCache.Invalidate(); - - Schedule(() => - { - BeatmapSetsChanged?.Invoke(); - initialLoadComplete = true; - }); - })); - } + BeatmapSetsChanged?.Invoke(); + initialLoadComplete = true; + }); + })); } private readonly List yPositions = new List(); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index ef03aff107..ac765c46ab 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -222,7 +222,7 @@ namespace osu.Game.Screens.Select sampleChangeDifficulty = await audio.Sample.GetAsync(@"SongSelect/select-difficulty"); sampleChangeBeatmap = await audio.Sample.GetAsync(@"SongSelect/select-expand"); - Carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSetsEnumerable(); + Carousel.LoadBeatmapSetsFromManager(this.beatmaps); } public void Edit(BeatmapInfo beatmap) From 73c764d9831d17b8186771cd0a1d40a2be97a5eb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Aug 2018 03:36:01 +0900 Subject: [PATCH 125/136] Update SpriteIcon --- osu.Game/Graphics/SpriteIcon.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index 6acd20719e..24b3f37505 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -24,7 +25,7 @@ namespace osu.Game.Graphics private FontStore store; [BackgroundDependencyLoader] - private void load(FontStore store) + private async Task load(FontStore store) { this.store = store; @@ -55,23 +56,23 @@ namespace osu.Game.Graphics }, }; - updateTexture(); + await updateTexture(); } protected override void LoadComplete() { base.LoadComplete(); - updateTexture(); + updateTexture().Wait(); } private FontAwesome loadedIcon; - private void updateTexture() + private async Task updateTexture() { var loadableIcon = icon; if (loadableIcon == loadedIcon) return; - var texture = store?.Get(((char)loadableIcon).ToString()); + var texture = await store.GetAsync(((char)loadableIcon).ToString()); spriteMain.Texture = texture; spriteShadow.Texture = texture; @@ -129,8 +130,8 @@ namespace osu.Game.Graphics if (icon == value) return; icon = value; - if (IsLoaded) - updateTexture(); + if (LoadState == LoadState.Loaded) + updateTexture().Wait(); } } } From 4b54c65d3f5a737c3a1634ee6c88bffcb8b4f937 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Aug 2018 15:11:02 +0900 Subject: [PATCH 126/136] Fix single file component loading not actually working correctly --- osu.Game/OsuGame.cs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 94678a9dde..f4afd23c1b 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -506,22 +506,24 @@ namespace osu.Game // we could avoid the need for scheduling altogether. Schedule(() => { - if (asyncLoadStream != null) + var previousLoadStream = asyncLoadStream; + + //chain with existing load stream + asyncLoadStream = Task.Run(async () => { - //chain with existing load stream - asyncLoadStream = asyncLoadStream.ContinueWith(async t => + if (previousLoadStream != null) + await previousLoadStream; + + try { - try - { - await LoadComponentAsync(d, add); - } - catch (OperationCanceledException) - { - } - }); - } - else - asyncLoadStream = LoadComponentAsync(d, add); + Logger.Log($"{d}...", LoggingTarget.Debug); + await LoadComponentAsync(d, add); + Logger.Log($"{d} ✓", LoggingTarget.Debug); + } + catch (OperationCanceledException) + { + } + }); }); } From 499c5d28ffb09d1047e57d3c16f90227429a82ee Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 Aug 2018 18:04:51 -0400 Subject: [PATCH 127/136] Refactored variable names in OsuGame.cs for improved code readability. --- osu.Game/OsuGame.cs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 94678a9dde..102df75420 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -75,10 +75,10 @@ namespace osu.Game { get { - Screen s = screenStack; - while (s != null && !(s is Intro)) - s = s.ChildScreen; - return s as Intro; + Screen screen = screenStack; + while (screen != null && !(screen is Intro)) + screen = screen.ChildScreen; + return screen as Intro; } } @@ -126,8 +126,8 @@ namespace osu.Game /// Whether the toolbar should also be hidden. public void CloseAllOverlays(bool toolbar = true) { - foreach (var o in overlays) - o.State = Visibility.Hidden; + foreach (var overlay in overlays) + overlay.State = Visibility.Hidden; if (toolbar) Toolbar.State = Visibility.Hidden; } @@ -244,7 +244,7 @@ namespace osu.Game /// The beatmap to show. public void ShowBeatmap(int beatmapId) => beatmapSetOverlay.FetchAndShowBeatmap(beatmapId); - protected void LoadScore(Score s) + protected void LoadScore(Score score) { scoreLoad?.Cancel(); @@ -252,18 +252,18 @@ namespace osu.Game if (menu == null) { - scoreLoad = Schedule(() => LoadScore(s)); + scoreLoad = Schedule(() => LoadScore(score)); return; } if (!menu.IsCurrentScreen) { menu.MakeCurrent(); - this.Delay(500).Schedule(() => LoadScore(s), out scoreLoad); + this.Delay(500).Schedule(() => LoadScore(score), out scoreLoad); return; } - if (s.Beatmap == null) + if (score.Beatmap == null) { notifications.Post(new SimpleNotification { @@ -273,12 +273,12 @@ namespace osu.Game return; } - ruleset.Value = s.Ruleset; + ruleset.Value = score.Ruleset; - Beatmap.Value = BeatmapManager.GetWorkingBeatmap(s.Beatmap); - Beatmap.Value.Mods.Value = s.Mods; + Beatmap.Value = BeatmapManager.GetWorkingBeatmap(score.Beatmap); + Beatmap.Value.Mods.Value = score.Mods; - menu.Push(new PlayerLoader(new ReplayPlayer(s.Replay))); + menu.Push(new PlayerLoader(new ReplayPlayer(score.Replay))); } protected override void Dispose(bool isDisposing) From 20817fdf1dc63cd7a378b8805185dc7a398bd48b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Aug 2018 11:58:30 +0900 Subject: [PATCH 128/136] Avoid using symbol windows can't diplay --- osu.Game/OsuGame.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index f4afd23c1b..78c6fa052b 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -516,9 +516,9 @@ namespace osu.Game try { - Logger.Log($"{d}...", LoggingTarget.Debug); + Logger.Log($"Loading {d}...", LoggingTarget.Debug); await LoadComponentAsync(d, add); - Logger.Log($"{d} ✓", LoggingTarget.Debug); + Logger.Log($"Loaded {d}!", LoggingTarget.Debug); } catch (OperationCanceledException) { From 327bc708d7ed5a12cdafbdae4aa7a662523ae097 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 29 Aug 2018 15:56:24 +0900 Subject: [PATCH 129/136] Fix DirectOverlay performing webrequests on startup --- osu.Game/Overlays/DirectOverlay.cs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 423211659d..f63d314053 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -240,6 +240,15 @@ namespace osu.Game.Overlays }); } + protected override void PopIn() + { + base.PopIn(); + + // Queries are allowed to be run only on the first pop-in + if (getSetsRequest == null) + Scheduler.AddOnce(updateSearch); + } + private SearchBeatmapSetsRequest getSetsRequest; private readonly Bindable currentQuery = new Bindable(); @@ -251,16 +260,22 @@ namespace osu.Game.Overlays { queryChangedDebounce?.Cancel(); - if (!IsLoaded) return; + if (!IsLoaded) + return; + + if (State == Visibility.Hidden) + return; BeatmapSets = null; ResultAmounts = null; getSetsRequest?.Cancel(); - if (api == null) return; + if (api == null) + return; - if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery == string.Empty)) return; + if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery == string.Empty)) + return; previewTrackManager.StopAnyPlaying(this); From b1a3dfedd1f0f809da4365a8a09041d311d55266 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Aug 2018 20:57:48 +0900 Subject: [PATCH 130/136] Reduce async-await pairs --- osu.Game/Beatmaps/BeatmapManager.cs | 6 +++--- osu.Game/Beatmaps/WorkingBeatmap.cs | 12 ++++++------ osu.Game/Graphics/ScreenshotManager.cs | 2 +- osu.Game/Skinning/LegacySkin.cs | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 774a80049b..1adbb4a389 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -319,17 +319,17 @@ namespace osu.Game.Beatmaps /// /// This is a temporary method and will likely be replaced by a full-fledged (and more correctly placed) migration process in the future. /// - public async Task ImportFromStable() + public Task ImportFromStable() { var stable = GetStableStorage?.Invoke(); if (stable == null) { Logger.Log("No osu!stable installation available!", LoggingTarget.Information, LogLevel.Error); - return; + return Task.CompletedTask; } - await Task.Factory.StartNew(() => Import(stable.GetDirectories("Songs").Select(f => stable.GetFullPath(f)).ToArray()), TaskCreationOptions.LongRunning); + return Task.Factory.StartNew(() => Import(stable.GetDirectories("Songs").Select(f => stable.GetFullPath(f)).ToArray()), TaskCreationOptions.LongRunning); } /// diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 6c906bb1e4..085c591fce 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -67,7 +67,7 @@ namespace osu.Game.Beatmaps public bool BeatmapLoaded => beatmap.IsResultAvailable; public IBeatmap Beatmap => beatmap.Value.Result; - public async Task GetBeatmapAsync() => await beatmap.Value; + public Task GetBeatmapAsync() => beatmap.Value; private readonly AsyncLazy beatmap; private IBeatmap populateBeatmap() @@ -138,14 +138,14 @@ namespace osu.Game.Beatmaps public bool BackgroundLoaded => background.IsResultAvailable; public Texture Background => background.Value.Result; - public async Task GetBackgroundAsync() => await background.Value; + public Task GetBackgroundAsync() => background.Value; private AsyncLazy background; private Texture populateBackground() => GetBackground(); public bool TrackLoaded => track.IsResultAvailable; public Track Track => track.Value.Result; - public async Task GetTrackAsync() => await track.Value; + public Task GetTrackAsync() => track.Value; private AsyncLazy track; private Track populateTrack() @@ -158,21 +158,21 @@ namespace osu.Game.Beatmaps public bool WaveformLoaded => waveform.IsResultAvailable; public Waveform Waveform => waveform.Value.Result; - public async Task GetWaveformAsync() => await waveform.Value; + public Task GetWaveformAsync() => waveform.Value; private readonly AsyncLazy waveform; private Waveform populateWaveform() => GetWaveform(); public bool StoryboardLoaded => storyboard.IsResultAvailable; public Storyboard Storyboard => storyboard.Value.Result; - public async Task GetStoryboardAsync() => await storyboard.Value; + public Task GetStoryboardAsync() => storyboard.Value; private readonly AsyncLazy storyboard; private Storyboard populateStoryboard() => GetStoryboard(); public bool SkinLoaded => skin.IsResultAvailable; public Skin Skin => skin.Value.Result; - public async Task GetSkinAsync() => await skin.Value; + public Task GetSkinAsync() => skin.Value; private readonly AsyncLazy skin; private Skin populateSkin() => GetSkin(); diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index 63b97e3c59..8426dc995b 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -71,7 +71,7 @@ namespace osu.Game.Graphics private volatile int screenShotTasks; - public async Task TakeScreenshotAsync() => await Task.Run(async () => + public Task TakeScreenshotAsync() => Task.Run(async () => { Interlocked.Increment(ref screenShotTasks); diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index f9801c2f92..9c881c6abb 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -111,10 +111,10 @@ namespace osu.Game.Skinning byte[] IResourceStore.Get(string name) => GetAsync(name).Result; - public async Task GetAsync(string name) + public Task GetAsync(string name) { string path = getPathForFile(name); - return path == null ? null : await underlyingStore.GetAsync(path); + return path == null ? Task.FromResult(null) : underlyingStore.GetAsync(path); } #region IDisposable Support From 68a79f895a3e4e5d4473c0b9490b638ec1e09ecc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Aug 2018 13:30:23 +0900 Subject: [PATCH 131/136] Fix mania throwing an exception on start of map --- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 4 ++-- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 2 +- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 2 +- osu.Game/Rulesets/UI/Playfield.cs | 14 +++++++------- osu.Game/Rulesets/UI/RulesetContainer.cs | 2 +- .../Rulesets/UI/Scrolling/ScrollingPlayfield.cs | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 6bf63443b5..999f84ed8e 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -26,11 +26,11 @@ namespace osu.Game.Rulesets.Mania.UI throw new ArgumentException("Can't have zero or fewer stages."); GridContainer playfieldGrid; - InternalChild = playfieldGrid = new GridContainer + AddInternal(playfieldGrid = new GridContainer { RelativeSizeAxes = Axes.Both, Content = new[] { new Drawable[stageDefinitions.Count] } - }; + }); var normalColumnAction = ManiaAction.Key1; var specialColumnAction = ManiaAction.Special1; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index 4047e057cb..f3b7d60cf0 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Mods const float relax_leniency = 3; - foreach (var drawable in playfield.HitObjects.AliveObjects) + foreach (var drawable in playfield.HitObjectContainer.AliveObjects) { if (!(drawable is DrawableOsuHitObject osuHit)) continue; diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 703d8764fc..61937a535c 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Osu.UI public override void PostProcess() { - connectionLayer.HitObjects = HitObjects.Objects.Select(d => d.HitObject).OfType(); + connectionLayer.HitObjects = HitObjectContainer.Objects.Select(d => d.HitObject).OfType(); } private void onNewResult(DrawableHitObject judgedObject, JudgementResult result) diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index da14fb54d6..e090a18eda 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -19,12 +19,12 @@ namespace osu.Game.Rulesets.UI /// /// The contained in this Playfield. /// - public HitObjectContainer HitObjects { get; private set; } + public HitObjectContainer HitObjectContainer { get; private set; } /// /// All the s contained in this and all . /// - public IEnumerable AllHitObjects => HitObjects?.Objects.Concat(NestedPlayfields.SelectMany(p => p.AllHitObjects)) ?? Enumerable.Empty(); + public IEnumerable AllHitObjects => HitObjectContainer?.Objects.Concat(NestedPlayfields.SelectMany(p => p.AllHitObjects)) ?? Enumerable.Empty(); /// /// All s nested inside this . @@ -60,10 +60,10 @@ namespace osu.Game.Rulesets.UI { this.beatmap = beatmap.Value; - HitObjects = CreateHitObjectContainer(); - HitObjects.RelativeSizeAxes = Axes.Both; + HitObjectContainer = CreateHitObjectContainer(); + HitObjectContainer.RelativeSizeAxes = Axes.Both; - Add(HitObjects); + Add(HitObjectContainer); } /// @@ -75,13 +75,13 @@ namespace osu.Game.Rulesets.UI /// Adds a DrawableHitObject to this Playfield. /// /// The DrawableHitObject to add. - public virtual void Add(DrawableHitObject h) => HitObjects.Add(h); + public virtual void Add(DrawableHitObject h) => HitObjectContainer.Add(h); /// /// Remove a DrawableHitObject from this Playfield. /// /// The DrawableHitObject to remove. - public virtual void Remove(DrawableHitObject h) => HitObjects.Remove(h); + public virtual void Remove(DrawableHitObject h) => HitObjectContainer.Remove(h); /// /// Registers a as a nested . diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index 64ee680d45..a830803fb1 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -306,7 +306,7 @@ namespace osu.Game.Rulesets.UI Playfield.PostProcess(); foreach (var mod in Mods.OfType()) - mod.ApplyToDrawableHitObjects(Playfield.HitObjects.Objects); + mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects); } protected override void Update() diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index 7146ad8064..ec73c0fb14 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.UI.Scrolling /// /// The container that contains the s. /// - public new ScrollingHitObjectContainer HitObjects => (ScrollingHitObjectContainer)base.HitObjects; + public new ScrollingHitObjectContainer HitObjects => (ScrollingHitObjectContainer)HitObjectContainer; /// /// The direction in which s in this should scroll. From 9fb78852de5d27772c151a495f02964eb606d6e4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Aug 2018 14:45:04 +0900 Subject: [PATCH 132/136] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 0633d7913e..5cde8c87d1 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 3276f0f54d9ae0be4bdb24de5b633bd7c22cc357 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Aug 2018 14:48:06 +0900 Subject: [PATCH 133/136] Update ef/sqlite version --- osu.Desktop/osu.Desktop.csproj | 4 ++-- osu.Game/osu.Game.csproj | 4 ++-- osu.TestProject.props | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 180abd7fec..e2fc4d14f6 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -28,8 +28,8 @@ - - + + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5cde8c87d1..2e7877f5ce 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -15,8 +15,8 @@ - - + + diff --git a/osu.TestProject.props b/osu.TestProject.props index a73a4f8ce2..58de6ec030 100644 --- a/osu.TestProject.props +++ b/osu.TestProject.props @@ -11,7 +11,7 @@ - + From 03084aa04ba7d09ebe4b9d3eda443769d6d51b3f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Aug 2018 07:04:40 +0900 Subject: [PATCH 134/136] Revert async changes --- osu.Desktop/Overlays/VersionManager.cs | 5 ++--- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 5 ++--- .../Objects/Drawables/Pieces/DefaultCirclePiece.cs | 5 ++--- osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs | 5 ++--- osu.Game.Rulesets.Taiko/UI/InputDrum.cs | 11 +++++------ osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs | 5 ++--- osu.Game/Graphics/Backgrounds/Background.cs | 5 ++--- .../Containers/OsuFocusedOverlayContainer.cs | 7 +++---- osu.Game/Graphics/Cursor/MenuCursor.cs | 7 +++---- osu.Game/Graphics/ScreenshotManager.cs | 4 ++-- osu.Game/Graphics/SpriteIcon.cs | 13 ++++++------- osu.Game/Graphics/Sprites/OsuSpriteText.cs | 2 +- osu.Game/Graphics/UserInterface/HoverClickSounds.cs | 5 ++--- osu.Game/Graphics/UserInterface/HoverSounds.cs | 5 ++--- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 7 +++---- osu.Game/Graphics/UserInterface/OsuMenu.cs | 7 +++---- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 5 ++--- osu.Game/Overlays/MedalOverlay.cs | 7 +++---- osu.Game/Overlays/MedalSplash/DrawableMedal.cs | 7 +++---- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 7 +++---- osu.Game/Overlays/MusicController.cs | 4 ++-- osu.Game/Overlays/Profile/Components/GradeBadge.cs | 5 ++--- osu.Game/Overlays/Profile/Header/BadgeContainer.cs | 5 ++--- osu.Game/Overlays/Profile/ProfileHeader.cs | 5 ++--- .../Overlays/Profile/Sections/Recent/MedalIcon.cs | 5 ++--- .../Screens/Backgrounds/BackgroundScreenBeatmap.cs | 5 ++--- osu.Game/Screens/Menu/Button.cs | 7 +++---- osu.Game/Screens/Menu/ButtonSystem.cs | 5 ++--- osu.Game/Screens/Menu/Intro.cs | 7 +++---- osu.Game/Screens/Menu/OsuLogo.cs | 11 +++++------ osu.Game/Screens/OsuScreen.cs | 5 ++--- osu.Game/Screens/Play/KeyCounter.cs | 7 +++---- osu.Game/Screens/Play/Player.cs | 4 ++-- osu.Game/Screens/Play/SkipOverlay.cs | 5 ++--- osu.Game/Screens/Ranking/ResultsPageScore.cs | 5 ++--- .../Screens/Select/Carousel/DrawableCarouselItem.cs | 5 ++--- .../Screens/Select/Leaderboards/DrawableRank.cs | 12 +++++++----- osu.Game/Screens/Select/PlaySongSelect.cs | 4 ++-- osu.Game/Screens/Select/SongSelect.cs | 7 +++---- .../Tournament/Components/VisualiserContainer.cs | 5 ++--- osu.Game/Screens/Tournament/Drawings.cs | 4 ++-- osu.Game/Screens/Tournament/Group.cs | 5 ++--- .../Screens/Tournament/ScrollingTeamContainer.cs | 5 ++--- osu.Game/Users/Avatar.cs | 7 +++---- osu.Game/Users/Country.cs | 9 ++++----- osu.Game/Users/UserCoverBackground.cs | 5 ++--- 46 files changed, 120 insertions(+), 157 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 740ad7c3be..1129969694 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -32,7 +31,7 @@ namespace osu.Desktop.Overlays public override bool HandleMouseInput => false; [BackgroundDependencyLoader] - private async Task load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host) + private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host) { notificationOverlay = notification; this.config = config; @@ -87,7 +86,7 @@ namespace osu.Desktop.Overlays { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Texture = await textures.GetAsync(@"Menu/dev-build-footer"), + Texture = textures.Get(@"Menu/dev-build-footer"), }, } } diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 99d902d3e4..4327abb96f 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -3,7 +3,6 @@ using System; using System.Linq; -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -449,9 +448,9 @@ namespace osu.Game.Rulesets.Catch.UI } [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { - Texture = await textures.GetAsync(@"Play/Catch/fruit-catcher-idle"); + Texture = textures.Get(@"Play/Catch/fruit-catcher-idle"); } } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/DefaultCirclePiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/DefaultCirclePiece.cs index c7c81756eb..86b60c3443 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/DefaultCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/DefaultCirclePiece.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 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.Graphics; using osu.Framework.Graphics.Containers; @@ -13,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public class DefaultCirclePiece : Container { [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { RelativeSizeAxes = Axes.Both; Children = new Drawable[] @@ -22,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Texture = await textures.GetAsync(@"Play/osu/disc"), + Texture = textures.Get(@"Play/osu/disc"), }, new TrianglesPiece { diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 4b981dc406..abcd1ddbda 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -4,7 +4,6 @@ using System; using System.Diagnostics; using System.Runtime.InteropServices; -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.OpenGL.Buffers; @@ -80,10 +79,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; [BackgroundDependencyLoader] - private async Task load(ShaderManager shaders, TextureStore textures) + private void load(ShaderManager shaders, TextureStore textures) { shader = shaders?.Load(@"CursorTrail", FragmentShaderDescriptor.TEXTURE); - texture = await textures.GetAsync(@"Cursor/cursortrail"); + texture = textures.Get(@"Cursor/cursortrail"); Scale = new Vector2(1 / texture.ScaleAdjust); } diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs index f525ce0ff3..524535bfde 100644 --- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Threading.Tasks; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -131,12 +130,12 @@ namespace osu.Game.Rulesets.Taiko.UI } [BackgroundDependencyLoader] - private async Task load(TextureStore textures, OsuColour colours) + private void load(TextureStore textures, OsuColour colours) { - rim.Texture = await textures.GetAsync(@"Play/Taiko/taiko-drum-outer"); - rimHit.Texture = await textures.GetAsync(@"Play/Taiko/taiko-drum-outer-hit"); - centre.Texture = await textures.GetAsync(@"Play/Taiko/taiko-drum-inner"); - centreHit.Texture = await textures.GetAsync(@"Play/Taiko/taiko-drum-inner-hit"); + rim.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer"); + rimHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer-hit"); + centre.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner"); + centreHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner-hit"); rimHit.Colour = colours.Blue; centreHit.Colour = colours.Pink; diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs index 9bba589f59..883c05f1e4 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; @@ -24,7 +23,7 @@ namespace osu.Game.Beatmaps.Drawables } [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { string resource = null; @@ -42,7 +41,7 @@ namespace osu.Game.Beatmaps.Drawables } if (resource != null) - Texture = await textures.GetAsync(resource); + Texture = textures.Get(resource); } } diff --git a/osu.Game/Graphics/Backgrounds/Background.cs b/osu.Game/Graphics/Backgrounds/Background.cs index dcd1db56de..d5825a8c42 100644 --- a/osu.Game/Graphics/Backgrounds/Background.cs +++ b/osu.Game/Graphics/Backgrounds/Background.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 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.Graphics; using osu.Framework.Graphics.Containers; @@ -35,10 +34,10 @@ namespace osu.Game.Graphics.Backgrounds } [BackgroundDependencyLoader] - private async Task load(LargeTextureStore textures) + private void load(LargeTextureStore textures) { if (!string.IsNullOrEmpty(textureName)) - Sprite.Texture = await textures.GetAsync(textureName); + Sprite.Texture = textures.Get(textureName); } } } diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index effcc696ca..d2ab8441eb 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 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; @@ -38,15 +37,15 @@ namespace osu.Game.Graphics.Containers } [BackgroundDependencyLoader(true)] - private async Task load(OsuGame osuGame, AudioManager audio, PreviewTrackManager previewTrackManager) + private void load(OsuGame osuGame, AudioManager audio, PreviewTrackManager previewTrackManager) { this.previewTrackManager = previewTrackManager; if (osuGame != null) OverlayActivationMode.BindTo(osuGame.OverlayActivationMode); - samplePopIn = await audio.Sample.GetAsync(@"UI/overlay-pop-in"); - samplePopOut = await audio.Sample.GetAsync(@"UI/overlay-pop-out"); + samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in"); + samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out"); StateChanged += onStateChanged; } diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 92b45ebcb9..b55e1aa5dd 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; using System; -using System.Threading.Tasks; using JetBrains.Annotations; using osu.Framework.Graphics.Textures; using osu.Framework.Input.EventArgs; @@ -133,7 +132,7 @@ namespace osu.Game.Graphics.Cursor } [BackgroundDependencyLoader] - private async Task load(OsuConfigManager config, TextureStore textures, OsuColour colour) + private void load(OsuConfigManager config, TextureStore textures, OsuColour colour) { Children = new Drawable[] { @@ -144,14 +143,14 @@ namespace osu.Game.Graphics.Cursor { new Sprite { - Texture = await textures.GetAsync(@"Cursor/menu-cursor"), + Texture = textures.Get(@"Cursor/menu-cursor"), }, AdditiveLayer = new Sprite { Blending = BlendingMode.Additive, Colour = colour.Pink, Alpha = 0, - Texture = await textures.GetAsync(@"Cursor/menu-cursor-additive"), + Texture = textures.Get(@"Cursor/menu-cursor-additive"), }, } } diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index 8426dc995b..be253f65c1 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -42,7 +42,7 @@ namespace osu.Game.Graphics private SampleChannel shutter; [BackgroundDependencyLoader] - private async Task load(GameHost host, OsuConfigManager config, Storage storage, NotificationOverlay notificationOverlay, AudioManager audio) + private void load(GameHost host, OsuConfigManager config, Storage storage, NotificationOverlay notificationOverlay, AudioManager audio) { this.host = host; this.storage = storage.GetStorageForDirectory(@"screenshots"); @@ -51,7 +51,7 @@ namespace osu.Game.Graphics screenshotFormat = config.GetBindable(OsuSetting.ScreenshotFormat); captureMenuCursor = config.GetBindable(OsuSetting.ScreenshotCaptureMenuCursor); - shutter = await audio.Sample.GetAsync("UI/shutter"); + shutter = audio.Sample.Get("UI/shutter"); } public bool OnPressed(GlobalAction action) diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index 24b3f37505..b72ba7e02f 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -25,7 +24,7 @@ namespace osu.Game.Graphics private FontStore store; [BackgroundDependencyLoader] - private async Task load(FontStore store) + private void load(FontStore store) { this.store = store; @@ -56,23 +55,23 @@ namespace osu.Game.Graphics }, }; - await updateTexture(); + updateTexture(); } protected override void LoadComplete() { base.LoadComplete(); - updateTexture().Wait(); + updateTexture(); } private FontAwesome loadedIcon; - private async Task updateTexture() + private void updateTexture() { var loadableIcon = icon; if (loadableIcon == loadedIcon) return; - var texture = await store.GetAsync(((char)loadableIcon).ToString()); + var texture = store.Get(((char)loadableIcon).ToString()); spriteMain.Texture = texture; spriteShadow.Texture = texture; @@ -131,7 +130,7 @@ namespace osu.Game.Graphics icon = value; if (LoadState == LoadState.Loaded) - updateTexture().Wait(); + updateTexture(); } } } diff --git a/osu.Game/Graphics/Sprites/OsuSpriteText.cs b/osu.Game/Graphics/Sprites/OsuSpriteText.cs index 12b816184e..c9389bb9e2 100644 --- a/osu.Game/Graphics/Sprites/OsuSpriteText.cs +++ b/osu.Game/Graphics/Sprites/OsuSpriteText.cs @@ -22,7 +22,7 @@ namespace osu.Game.Graphics.Sprites protected override Drawable CreateFallbackCharacterDrawable() { - var tex = GetTextureForCharacter('?').Result; + var tex = GetTextureForCharacter('?'); if (tex != null) { diff --git a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs index 17924cdbb8..27a06ba0b7 100644 --- a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 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; @@ -29,9 +28,9 @@ namespace osu.Game.Graphics.UserInterface } [BackgroundDependencyLoader] - private async Task load(AudioManager audio) + private void load(AudioManager audio) { - sampleClick = await audio.Sample.GetAsync($@"UI/generic-select{SampleSet.GetDescription()}"); + sampleClick = audio.Sample.Get($@"UI/generic-select{SampleSet.GetDescription()}"); } } } diff --git a/osu.Game/Graphics/UserInterface/HoverSounds.cs b/osu.Game/Graphics/UserInterface/HoverSounds.cs index b3a83d1cc8..821305bc92 100644 --- a/osu.Game/Graphics/UserInterface/HoverSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverSounds.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.ComponentModel; -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -36,9 +35,9 @@ namespace osu.Game.Graphics.UserInterface } [BackgroundDependencyLoader] - private async Task load(AudioManager audio) + private void load(AudioManager audio) { - sampleHover = await audio.Sample.GetAsync($@"UI/generic-hover{SampleSet.GetDescription()}"); + sampleHover = audio.Sample.Get($@"UI/generic-hover{SampleSet.GetDescription()}"); } } diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index d6b4b51851..68f59bd8cd 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 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; @@ -111,10 +110,10 @@ namespace osu.Game.Graphics.UserInterface } [BackgroundDependencyLoader] - private async Task load(AudioManager audio) + private void load(AudioManager audio) { - sampleChecked = await audio.Sample.GetAsync(@"UI/check-on"); - sampleUnchecked = await audio.Sample.GetAsync(@"UI/check-off"); + sampleChecked = audio.Sample.Get(@"UI/check-on"); + sampleUnchecked = audio.Sample.Get(@"UI/check-off"); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index b5ebac0c74..abb077e94f 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 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; @@ -70,10 +69,10 @@ namespace osu.Game.Graphics.UserInterface } [BackgroundDependencyLoader] - private async Task load(AudioManager audio) + private void load(AudioManager audio) { - sampleHover = await audio.Sample.GetAsync(@"UI/generic-hover"); - sampleClick = await audio.Sample.GetAsync(@"UI/generic-select"); + sampleHover = audio.Sample.Get(@"UI/generic-hover"); + sampleClick = audio.Sample.Get(@"UI/generic-select"); BackgroundColour = Color4.Transparent; BackgroundColourHover = OsuColour.FromHex(@"172023"); diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index cd0b3dcad2..b7b5319e06 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -3,7 +3,6 @@ using System; using System.Globalization; -using System.Threading.Tasks; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -120,9 +119,9 @@ namespace osu.Game.Graphics.UserInterface } [BackgroundDependencyLoader] - private async Task load(AudioManager audio, OsuColour colours) + private void load(AudioManager audio, OsuColour colours) { - sample = await audio.Sample.GetAsync(@"UI/sliderbar-notch"); + sample = audio.Sample.Get(@"UI/sliderbar-notch"); AccentColour = colours.Pink; } diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 038fa936b0..bd67a718a7 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -20,7 +20,6 @@ using OpenTK.Input; using osu.Framework.Graphics.Shapes; using System; using System.Linq; -using System.Threading.Tasks; using osu.Framework.Input.States; using osu.Framework.MathUtils; @@ -144,10 +143,10 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private async Task load(OsuColour colours, TextureStore textures, AudioManager audio) + private void load(OsuColour colours, TextureStore textures, AudioManager audio) { - getSample = await audio.Sample.GetAsync(@"MedalSplash/medal-get"); - innerSpin.Texture = outerSpin.Texture = await textures.GetAsync(@"MedalSplash/disc-spin"); + getSample = audio.Sample.Get(@"MedalSplash/medal-get"); + innerSpin.Texture = outerSpin.Texture = textures.Get(@"MedalSplash/disc-spin"); disc.EdgeEffect = leftStrip.EdgeEffect = rightStrip.EdgeEffect = new EdgeEffectParameters { diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index 9ced6520df..a27278e002 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Threading.Tasks; using osu.Framework; using OpenTK; using osu.Framework.Allocation; @@ -119,10 +118,10 @@ namespace osu.Game.Overlays.MedalSplash } [BackgroundDependencyLoader] - private async Task load(OsuColour colours, TextureStore textures) + private void load(OsuColour colours, TextureStore textures) { - medalSprite.Texture = await textures.GetAsync(medal.ImageUrl); - medalGlow.Texture = await textures.GetAsync(@"MedalSplash/medal-glow"); + medalSprite.Texture = textures.Get(medal.ImageUrl); + medalGlow.Texture = textures.Get(@"MedalSplash/medal-glow"); description.Colour = colours.BlueLight; } diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 783fcfa090..e83dedaf35 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -15,7 +15,6 @@ using osu.Game.Rulesets.Mods; using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics.Shapes; @@ -50,7 +49,7 @@ namespace osu.Game.Overlays.Mods protected readonly IBindable Ruleset = new Bindable(); [BackgroundDependencyLoader(true)] - private async Task load(OsuColour colours, IBindable ruleset, AudioManager audio, Bindable> selectedMods) + private void load(OsuColour colours, IBindable ruleset, AudioManager audio, Bindable> selectedMods) { LowMultiplierColour = colours.Red; HighMultiplierColour = colours.Green; @@ -59,8 +58,8 @@ namespace osu.Game.Overlays.Mods Ruleset.BindTo(ruleset); if (selectedMods != null) SelectedMods.BindTo(selectedMods); - sampleOn = await audio.Sample.GetAsync(@"UI/check-on"); - sampleOff = await audio.Sample.GetAsync(@"UI/check-off"); + sampleOn = audio.Sample.Get(@"UI/check-on"); + sampleOff = audio.Sample.Get(@"UI/check-off"); } protected override void LoadComplete() diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 42f89a4863..886b5fb95b 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -454,9 +454,9 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { - sprite.Texture = beatmap?.Background ?? await textures.GetAsync(@"Backgrounds/bg4"); + sprite.Texture = beatmap?.Background ?? textures.Get(@"Backgrounds/bg4"); } } diff --git a/osu.Game/Overlays/Profile/Components/GradeBadge.cs b/osu.Game/Overlays/Profile/Components/GradeBadge.cs index 3943a5f86b..14a47e8d03 100644 --- a/osu.Game/Overlays/Profile/Components/GradeBadge.cs +++ b/osu.Game/Overlays/Profile/Components/GradeBadge.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 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.Graphics; using osu.Framework.Graphics.Containers; @@ -43,9 +42,9 @@ namespace osu.Game.Overlays.Profile.Components } [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { - badge.Texture = await textures.GetAsync($"Grades/{grade}"); + badge.Texture = textures.Get($"Grades/{grade}"); } } } diff --git a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs index f87aefb28a..bfade5e45c 100644 --- a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs +++ b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -177,13 +176,13 @@ namespace osu.Game.Overlays.Profile.Header } [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { Child = new Sprite { FillMode = FillMode.Fit, RelativeSizeAxes = Axes.Both, - Texture = await textures.GetAsync(badge.ImageUrl), + Texture = textures.Get(badge.ImageUrl), }; } diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 48048d2935..9d09836d25 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Threading.Tasks; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -312,9 +311,9 @@ namespace osu.Game.Overlays.Profile } [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { - levelBadge.Texture = await textures.GetAsync(@"Profile/levelbadge"); + levelBadge.Texture = textures.Get(@"Profile/levelbadge"); } private User user; diff --git a/osu.Game/Overlays/Profile/Sections/Recent/MedalIcon.cs b/osu.Game/Overlays/Profile/Sections/Recent/MedalIcon.cs index 2eec75c875..0d354c728f 100644 --- a/osu.Game/Overlays/Profile/Sections/Recent/MedalIcon.cs +++ b/osu.Game/Overlays/Profile/Sections/Recent/MedalIcon.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 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.Graphics.Containers; using osu.Framework.Graphics; @@ -31,9 +30,9 @@ namespace osu.Game.Overlays.Profile.Sections.Recent } [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { - sprite.Texture = await textures.GetAsync(url); + sprite.Texture = textures.Get(url); } } } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 14d4cab870..78561cecbf 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 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.Graphics; using osu.Framework.Graphics.Textures; @@ -76,9 +75,9 @@ namespace osu.Game.Screens.Backgrounds } [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { - Sprite.Texture = beatmap?.Background ?? await textures.GetAsync(@"Backgrounds/bg1"); + Sprite.Texture = beatmap?.Background ?? textures.Get(@"Backgrounds/bg1"); } } } diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 3593568578..e53905a102 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Threading.Tasks; using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -180,11 +179,11 @@ namespace osu.Game.Screens.Menu } [BackgroundDependencyLoader] - private async Task load(AudioManager audio) + private void load(AudioManager audio) { - sampleHover = await audio.Sample.GetAsync(@"Menu/button-hover"); + sampleHover = audio.Sample.Get(@"Menu/button-hover"); if (!string.IsNullOrEmpty(sampleName)) - sampleClick = await audio.Sample.GetAsync($@"Menu/{sampleName}"); + sampleClick = audio.Sample.Get($@"Menu/{sampleName}"); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 4137028527..b9a799328e 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -103,10 +102,10 @@ namespace osu.Game.Screens.Menu private OsuGame game; [BackgroundDependencyLoader(true)] - private async Task load(AudioManager audio, OsuGame game) + private void load(AudioManager audio, OsuGame game) { this.game = game; - sampleBack = await audio.Sample.GetAsync(@"Menu/button-back-select"); + sampleBack = audio.Sample.Get(@"Menu/button-back-select"); } public bool OnPressed(GlobalAction action) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 5d39d70e26..c1032011f7 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 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; @@ -48,7 +47,7 @@ namespace osu.Game.Screens.Menu private WorkingBeatmap introBeatmap; [BackgroundDependencyLoader] - private async Task load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap) + private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap) { this.beatmap.BindTo(beatmap); @@ -81,8 +80,8 @@ namespace osu.Game.Screens.Menu introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); track = introBeatmap.Track; - welcome = await audio.Sample.GetAsync(@"welcome"); - seeya = await audio.Sample.GetAsync(@"seeya"); + welcome = audio.Sample.Get(@"welcome"); + seeya = audio.Sample.Get(@"seeya"); } private const double delay_step_one = 2300; diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index c6cfd9ba2d..f0f765a4c9 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -254,13 +253,13 @@ namespace osu.Game.Screens.Menu } [BackgroundDependencyLoader] - private async Task load(TextureStore textures, AudioManager audio) + private void load(TextureStore textures, AudioManager audio) { - sampleClick = await audio.Sample.GetAsync(@"Menu/osu-logo-select"); - sampleBeat = await audio.Sample.GetAsync(@"Menu/osu-logo-heartbeat"); + sampleClick = audio.Sample.Get(@"Menu/osu-logo-select"); + sampleBeat = audio.Sample.Get(@"Menu/osu-logo-heartbeat"); - logo.Texture = await textures.GetAsync(@"Menu/logo"); - ripple.Texture = await textures.GetAsync(@"Menu/logo"); + logo.Texture = textures.Get(@"Menu/logo"); + ripple.Texture = textures.Get(@"Menu/logo"); } private int lastBeatIndex; diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 3929e631cf..4b893f0118 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore.Internal; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -81,7 +80,7 @@ namespace osu.Game.Screens private SampleChannel sampleExit; [BackgroundDependencyLoader(true)] - private async Task load(BindableBeatmap beatmap, OsuGame osu, AudioManager audio, Bindable ruleset) + private void load(BindableBeatmap beatmap, OsuGame osu, AudioManager audio, Bindable ruleset) { Beatmap.BindTo(beatmap); Ruleset.BindTo(ruleset); @@ -99,7 +98,7 @@ namespace osu.Game.Screens }; } - sampleExit = await audio.Sample.GetAsync(@"UI/screen-back"); + sampleExit = audio.Sample.Get(@"UI/screen-back"); } public virtual bool OnPressed(GlobalAction action) diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 49500a8426..2c31e61114 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 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.Graphics; using osu.Framework.Graphics.Containers; @@ -62,19 +61,19 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { Children = new Drawable[] { buttonSprite = new Sprite { - Texture = await textures.GetAsync(@"KeyCounter/key-up"), + Texture = textures.Get(@"KeyCounter/key-up"), Anchor = Anchor.Centre, Origin = Anchor.Centre, }, glowSprite = new Sprite { - Texture = await textures.GetAsync(@"KeyCounter/key-glow"), + Texture = textures.Get(@"KeyCounter/key-glow"), Anchor = Anchor.Centre, Origin = Anchor.Centre, Alpha = 0 diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 863d12c1c2..5ad0130fd7 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -84,7 +84,7 @@ namespace osu.Game.Screens.Play public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true; [BackgroundDependencyLoader] - private async Task load(AudioManager audio, APIAccess api, OsuConfigManager config) + private void load(AudioManager audio, APIAccess api, OsuConfigManager config) { this.api = api; @@ -92,7 +92,7 @@ namespace osu.Game.Screens.Play if (working is DummyWorkingBeatmap) return; - sampleRestart = await audio.Sample.GetAsync(@"Gameplay/restart"); + sampleRestart = audio.Sample.Get(@"Gameplay/restart"); mouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); userAudioOffset = config.GetBindable(OsuSetting.AudioOffset); diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index 9aaaa6152c..06837c9274 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Threading.Tasks; using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -225,12 +224,12 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader] - private async Task load(OsuColour colours, AudioManager audio) + private void load(OsuColour colours, AudioManager audio) { colourNormal = colours.Yellow; colourHover = colours.YellowDark; - sampleConfirm = await audio.Sample.GetAsync(@"SongSelect/confirm-selection"); + sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection"); Children = new Drawable[] { diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 87e53b8182..42d8af07b9 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -369,10 +368,10 @@ namespace osu.Game.Screens.Ranking } [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { if (!string.IsNullOrEmpty(user.CoverUrl)) - cover.Texture = await textures.GetAsync(user.CoverUrl); + cover.Texture = textures.Get(user.CoverUrl); } } diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs index b252f116ac..8a0052559e 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 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; @@ -46,7 +45,7 @@ namespace osu.Game.Screens.Select.Carousel private SampleChannel sampleHover; [BackgroundDependencyLoader] - private async Task load(AudioManager audio, OsuColour colours) + private void load(AudioManager audio, OsuColour colours) { InternalChild = borderContainer = new Container { @@ -69,7 +68,7 @@ namespace osu.Game.Screens.Select.Carousel } }; - sampleHover = await audio.Sample.GetAsync($@"SongSelect/song-ping-variation-{RNG.Next(1, 5)}"); + sampleHover = audio.Sample.Get($@"SongSelect/song-ping-variation-{RNG.Next(1, 5)}"); hoverLayer.Colour = colours.Blue.Opacity(0.1f); } diff --git a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs index f5f9ebbdaf..0cf1e60304 100644 --- a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs +++ b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 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.Graphics; using osu.Framework.Graphics.Containers; @@ -36,20 +35,23 @@ namespace osu.Game.Screens.Select.Leaderboards } [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { this.textures = textures; - await updateTexture(); + updateTexture(); } - private async Task updateTexture() => rankSprite.Texture = await textures.GetAsync($@"Grades/{Rank.GetDescription()}"); + private void updateTexture() + { + rankSprite.Texture = textures.Get($@"Grades/{Rank.GetDescription()}"); + } public void UpdateRank(ScoreRank newRank) { Rank = newRank; if (LoadState >= LoadState.Ready) - updateTexture().Wait(); + updateTexture(); } } } diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index cab7bdfe73..e914eb365e 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -55,11 +55,11 @@ namespace osu.Game.Screens.Select private readonly Bindable> selectedMods = new Bindable>(new Mod[] { }); [BackgroundDependencyLoader(true)] - private async Task load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, Bindable> selectedMods) + private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, Bindable> selectedMods) { if (selectedMods != null) this.selectedMods.BindTo(selectedMods); - sampleConfirm = await audio.Sample.GetAsync(@"SongSelect/confirm-selection"); + sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection"); Footer.AddButton(@"mods", colours.Yellow, modSelect, Key.F1, float.MaxValue); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index ac765c46ab..efdf55e477 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -3,7 +3,6 @@ using System; using System.Linq; -using System.Threading.Tasks; using OpenTK; using OpenTK.Input; using osu.Framework.Allocation; @@ -199,7 +198,7 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader(true)] - private async Task load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours) + private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours) { if (Footer != null) { @@ -219,8 +218,8 @@ namespace osu.Game.Screens.Select dialogOverlay = dialog; - sampleChangeDifficulty = await audio.Sample.GetAsync(@"SongSelect/select-difficulty"); - sampleChangeBeatmap = await audio.Sample.GetAsync(@"SongSelect/select-expand"); + sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty"); + sampleChangeBeatmap = audio.Sample.Get(@"SongSelect/select-expand"); Carousel.LoadBeatmapSetsFromManager(this.beatmaps); } diff --git a/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs b/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs index 835b0757e0..1453d4e78f 100644 --- a/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs +++ b/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics.Textures; using osu.Framework.MathUtils; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; namespace osu.Game.Screens.Tournament.Components { @@ -76,9 +75,9 @@ namespace osu.Game.Screens.Tournament.Components private int expiredCount; [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { - texture = await textures.GetAsync("Drawings/visualiser-line"); + texture = textures.Get("Drawings/visualiser-line"); } protected override void UpdateAfterChildren() diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 20180a660f..63d29d5cd7 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Tournament dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); [BackgroundDependencyLoader] - private async Task load(TextureStore textures, Storage storage) + private void load(TextureStore textures, Storage storage) { this.storage = storage; @@ -87,7 +87,7 @@ namespace osu.Game.Screens.Tournament { RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, - Texture = await textures.GetAsync(@"Backgrounds/Drawings/background.png") + Texture = textures.Get(@"Backgrounds/Drawings/background.png") }, new FillFlowContainer { diff --git a/osu.Game/Screens/Tournament/Group.cs b/osu.Game/Screens/Tournament/Group.cs index 5128166c15..6845d8fc48 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game/Screens/Tournament/Group.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -179,9 +178,9 @@ namespace osu.Game.Screens.Tournament } [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { - flagSprite.Texture = await textures.GetAsync($@"Flags/{Team.FlagName}"); + flagSprite.Texture = textures.Get($@"Flags/{Team.FlagName}"); } } } diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index cc9f805c62..d1c7e0fced 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -373,9 +372,9 @@ namespace osu.Game.Screens.Tournament } [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { - flagSprite.Texture = await textures.GetAsync($@"Flags/{Team.FlagName}"); + flagSprite.Texture = textures.Get($@"Flags/{Team.FlagName}"); } } } diff --git a/osu.Game/Users/Avatar.cs b/osu.Game/Users/Avatar.cs index 9aac662a84..9ba9549164 100644 --- a/osu.Game/Users/Avatar.cs +++ b/osu.Game/Users/Avatar.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -25,14 +24,14 @@ namespace osu.Game.Users } [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { if (textures == null) throw new ArgumentNullException(nameof(textures)); Texture texture = null; - if (user != null && user.Id > 1) texture = await textures.GetAsync($@"https://a.ppy.sh/{user.Id}"); - if (texture == null) texture = await textures.GetAsync(@"Online/avatar-guest"); + if (user != null && user.Id > 1) texture = textures.Get($@"https://a.ppy.sh/{user.Id}"); + if (texture == null) texture = textures.Get(@"Online/avatar-guest"); Add(new Sprite { diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index a37ca10f9a..80039eadad 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Threading.Tasks; using Newtonsoft.Json; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -45,7 +44,7 @@ namespace osu.Game.Users country = value; if (LoadState >= LoadState.Ready) - sprite.Texture = getFlagTexture().Result; + sprite.Texture = getFlagTexture(); } } @@ -65,15 +64,15 @@ namespace osu.Game.Users } [BackgroundDependencyLoader] - private async Task load(TextureStore ts) + private void load(TextureStore ts) { if (ts == null) throw new ArgumentNullException(nameof(ts)); textures = ts; - sprite.Texture = await getFlagTexture(); + sprite.Texture = getFlagTexture(); } - private async Task getFlagTexture() => await textures.GetAsync($@"Flags/{country?.FlagName ?? @"__"}"); + private Texture getFlagTexture() => textures.Get($@"Flags/{country?.FlagName ?? @"__"}"); } } diff --git a/osu.Game/Users/UserCoverBackground.cs b/osu.Game/Users/UserCoverBackground.cs index 97d2648e07..58b92b2750 100644 --- a/osu.Game/Users/UserCoverBackground.cs +++ b/osu.Game/Users/UserCoverBackground.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; @@ -19,13 +18,13 @@ namespace osu.Game.Users } [BackgroundDependencyLoader] - private async Task load(TextureStore textures) + private void load(TextureStore textures) { if (textures == null) throw new ArgumentNullException(nameof(textures)); if (!string.IsNullOrEmpty(user.CoverUrl)) - Texture = await textures.GetAsync(user.CoverUrl); + Texture = textures.Get(user.CoverUrl); } } } From 4c725659363feb890b75d0931245555d3dc47ec1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Aug 2018 19:20:10 +0900 Subject: [PATCH 135/136] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 2e7877f5ce..61b7888513 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 62a8245f11577226336b76572fb3a1b915af254e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 1 Sep 2018 10:59:04 +0900 Subject: [PATCH 136/136] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 61b7888513..669b775674 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - +