From bb6478cdc3e98dee0cbfb8a6d722d012ae556233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Thu, 10 May 2018 10:15:47 +0200 Subject: [PATCH 001/304] Adds a check to disable music controller's seek --- osu.Game/Overlays/MusicController.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index b4021f2808..0605b211b0 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -206,7 +206,7 @@ namespace osu.Game.Overlays Anchor = Anchor.BottomCentre, Height = progress_height, FillColour = colours.Yellow, - OnSeek = progress => current?.Track.Seek(progress) + OnSeek = progress => ConditionalSeek(progress) } }, }, @@ -219,6 +219,13 @@ namespace osu.Game.Overlays playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } + private bool? ConditionalSeek(double progress) + { + if (current.Track.Looping) + return current?.Track.Seek(progress); + return false; + } + protected override void LoadComplete() { beatmapBacking.ValueChanged += beatmapChanged; From 5b99d8df62c5176f1400d41c81e88905d7c108e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Thu, 10 May 2018 11:29:19 +0200 Subject: [PATCH 002/304] Fixes private method name capitalization --- osu.Game/Overlays/MusicController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 0605b211b0..ee928b3ccc 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -206,7 +206,7 @@ namespace osu.Game.Overlays Anchor = Anchor.BottomCentre, Height = progress_height, FillColour = colours.Yellow, - OnSeek = progress => ConditionalSeek(progress) + OnSeek = progress => conditionalSeek(progress) } }, }, @@ -219,7 +219,7 @@ namespace osu.Game.Overlays playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } - private bool? ConditionalSeek(double progress) + private bool? conditionalSeek(double progress) { if (current.Track.Looping) return current?.Track.Seek(progress); From d54a7295f6a72a49cd7d7eece02cbb4cdb30f5b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Thu, 10 May 2018 13:20:04 +0200 Subject: [PATCH 003/304] Adds DisableSeek property to MusicController --- osu.Game/OsuGame.cs | 9 ++++++--- osu.Game/Overlays/MusicController.cs | 6 +++--- osu.Game/Screens/OsuScreen.cs | 2 ++ osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 2 ++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index d443ed36ae..4d6b4520fe 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -537,10 +537,13 @@ namespace osu.Game // we only want to apply these restrictions when we are inside a screen stack. // the use case for not applying is in visual/unit tests. - bool applyRestrictions = !currentScreen?.AllowBeatmapRulesetChange ?? false; + bool applyBeatmapRulesetRestrictions = !currentScreen?.AllowBeatmapRulesetChange ?? false; + bool applyUserSeekRestrictions = !currentScreen?.AllowUserSeek ?? false; - Ruleset.Disabled = applyRestrictions; - Beatmap.Disabled = applyRestrictions; + Ruleset.Disabled = applyBeatmapRulesetRestrictions; + Beatmap.Disabled = applyBeatmapRulesetRestrictions; + + musicController.DisableSeek = applyUserSeekRestrictions; mainContent.Padding = new MarginPadding { Top = ToolbarOffset }; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index ee928b3ccc..9cfce04685 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -221,9 +221,7 @@ namespace osu.Game.Overlays private bool? conditionalSeek(double progress) { - if (current.Track.Looping) - return current?.Track.Seek(progress); - return false; + return DisableSeek ? false : current?.Track.Seek(progress); } protected override void LoadComplete() @@ -235,6 +233,8 @@ namespace osu.Game.Overlays base.LoadComplete(); } + public bool DisableSeek { get; set; } + private void beatmapDisabledChanged(bool disabled) { if (disabled) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 7a910574e0..48c3d95b0c 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -50,6 +50,8 @@ namespace osu.Game.Screens /// public virtual bool AllowBeatmapRulesetChange => true; + public virtual bool AllowUserSeek => true; + protected readonly Bindable Beatmap = new Bindable(); protected virtual float BackgroundParallaxAmount => 1; diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 1ccc5e2fe8..add02732d4 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -17,6 +17,8 @@ namespace osu.Game.Screens.Play public override bool AllowBeatmapRulesetChange => false; + public override bool AllowUserSeek => false; + protected const float BACKGROUND_FADE_DURATION = 800; protected float BackgroundOpacity => 1 - (float)DimLevel; From a877855fc615f697d4d205a304d4dde62031e70a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Fri, 11 May 2018 09:39:55 +0200 Subject: [PATCH 004/304] Changes conditionSeek return type to void --- osu.Game/Overlays/MusicController.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 9cfce04685..a0074ccee7 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -219,9 +219,11 @@ namespace osu.Game.Overlays playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } - private bool? conditionalSeek(double progress) + private void conditionalSeek(double progress) { - return DisableSeek ? false : current?.Track.Seek(progress); + if (DisableSeek) + return; + current?.Track.Seek(progress); } protected override void LoadComplete() From 17ed5e48390cb3d19fb8ae2554b86c6aa60a3985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Fri, 11 May 2018 09:41:31 +0200 Subject: [PATCH 005/304] Moves seek restrictions to Player --- osu.Game/Screens/Play/Player.cs | 2 ++ osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 83958b2912..8989cbaad4 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -45,6 +45,8 @@ namespace osu.Game.Screens.Play public bool AllowLeadIn { get; set; } = true; public bool AllowResults { get; set; } = true; + public override bool AllowUserSeek => false; + private Bindable mouseWheelDisabled; private Bindable userAudioOffset; diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index add02732d4..1ccc5e2fe8 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -17,8 +17,6 @@ namespace osu.Game.Screens.Play public override bool AllowBeatmapRulesetChange => false; - public override bool AllowUserSeek => false; - protected const float BACKGROUND_FADE_DURATION = 800; protected float BackgroundOpacity => 1 - (float)DimLevel; From c55d47ff1085d0b215f3619678bcbac277c63adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Fri, 11 May 2018 09:56:23 +0200 Subject: [PATCH 006/304] Converts OnSeek assignment to method group --- osu.Game/Overlays/MusicController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index a0074ccee7..45a59a0f87 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -206,7 +206,7 @@ namespace osu.Game.Overlays Anchor = Anchor.BottomCentre, Height = progress_height, FillColour = colours.Yellow, - OnSeek = progress => conditionalSeek(progress) + OnSeek = conditionalSeek } }, }, From a7e7c3a74a2132d173f2be310e2583acd808d126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Sat, 12 May 2018 11:55:52 +0200 Subject: [PATCH 007/304] Enables/Disables seek and Play/Resume on call to beatmapDisabledChanged --- osu.Game/OsuGame.cs | 3 --- osu.Game/Overlays/MusicController.cs | 9 +++++---- osu.Game/Screens/OsuScreen.cs | 2 -- osu.Game/Screens/Play/Player.cs | 2 -- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4d6b4520fe..4e79ea48ca 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -538,13 +538,10 @@ namespace osu.Game // we only want to apply these restrictions when we are inside a screen stack. // the use case for not applying is in visual/unit tests. bool applyBeatmapRulesetRestrictions = !currentScreen?.AllowBeatmapRulesetChange ?? false; - bool applyUserSeekRestrictions = !currentScreen?.AllowUserSeek ?? false; Ruleset.Disabled = applyBeatmapRulesetRestrictions; Beatmap.Disabled = applyBeatmapRulesetRestrictions; - musicController.DisableSeek = applyUserSeekRestrictions; - mainContent.Padding = new MarginPadding { Top = ToolbarOffset }; CursorOverrideContainer.CanShowCursor = currentScreen?.CursorVisible ?? false; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 45a59a0f87..8ff8dfb3ad 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -221,9 +221,8 @@ namespace osu.Game.Overlays private void conditionalSeek(double progress) { - if (DisableSeek) - return; - current?.Track.Seek(progress); + if (EnableSeek) + current?.Track.Seek(progress); } protected override void LoadComplete() @@ -235,16 +234,18 @@ namespace osu.Game.Overlays base.LoadComplete(); } - public bool DisableSeek { get; set; } + private bool EnableSeek { get; set; } private void beatmapDisabledChanged(bool disabled) { if (disabled) playlist.Hide(); + playButton.Enabled.Value = !disabled; prevButton.Enabled.Value = !disabled; nextButton.Enabled.Value = !disabled; playlistButton.Enabled.Value = !disabled; + EnableSeek = !disabled; } protected override void UpdateAfterChildren() diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 48c3d95b0c..7a910574e0 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -50,8 +50,6 @@ namespace osu.Game.Screens /// public virtual bool AllowBeatmapRulesetChange => true; - public virtual bool AllowUserSeek => true; - protected readonly Bindable Beatmap = new Bindable(); protected virtual float BackgroundParallaxAmount => 1; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2e6db93065..f397d0c3d4 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -45,8 +45,6 @@ namespace osu.Game.Screens.Play public bool AllowLeadIn { get; set; } = true; public bool AllowResults { get; set; } = true; - public override bool AllowUserSeek => false; - private Bindable mouseWheelDisabled; private Bindable userAudioOffset; From 861a8cf9a749a079f983ac38b4bb38fe0704f790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Sat, 12 May 2018 23:10:03 +0200 Subject: [PATCH 008/304] Fixes capitalization of enableSeek --- osu.Game/Overlays/MusicController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 8ff8dfb3ad..0406bb812c 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -221,7 +221,7 @@ namespace osu.Game.Overlays private void conditionalSeek(double progress) { - if (EnableSeek) + if (enableSeek) current?.Track.Seek(progress); } @@ -234,7 +234,7 @@ namespace osu.Game.Overlays base.LoadComplete(); } - private bool EnableSeek { get; set; } + private bool enableSeek { get; set; } private void beatmapDisabledChanged(bool disabled) { @@ -245,7 +245,7 @@ namespace osu.Game.Overlays prevButton.Enabled.Value = !disabled; nextButton.Enabled.Value = !disabled; playlistButton.Enabled.Value = !disabled; - EnableSeek = !disabled; + enableSeek = !disabled; } protected override void UpdateAfterChildren() From d504a44dfb08d78024bbd512695270198d80c3cd Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Sun, 20 May 2018 13:22:42 +0300 Subject: [PATCH 009/304] Implement mask layering (incomplete) --- .../Layers/Selection/Overlays/HoldNoteMask.cs | 50 ++++++++++++++++ .../Overlays/ManiaHitObjectColumnMaskLayer.cs | 29 ++++++++++ .../Overlays/ManiaHitObjectMaskLayer.cs | 28 +++++++++ .../Overlays/ManiaHitObjectStageMaskLayer.cs | 31 ++++++++++ .../Layers/Selection/Overlays/NoteMask.cs | 35 +++++++++++ .../Edit/ManiaHitObjectComposer.cs | 58 +++++++++++++++++++ .../Objects/Drawables/DrawableHoldNote.cs | 26 ++++----- .../Objects/ManiaHitObject.cs | 34 ++++++++++- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 35 +++++++---- .../osu.Game.Rulesets.Mania.csproj | 3 + osu.Game/Rulesets/Edit/HitObjectComposer.cs | 24 +++++--- osu.Game/Rulesets/Edit/HitObjectMask.cs | 22 ++++++- .../Edit/Tools/HitObjectCompositionTool.cs | 16 ++++- .../Rulesets/Edit/Tools/ICompositionTool.cs | 6 ++ .../Rulesets/Edit/Types/IHasEditableColumn.cs | 12 ++++ .../Rulesets/Edit/Types/IHasEditableLayer.cs | 12 ++++ .../Rulesets}/Objects/Types/IHasColumn.cs | 2 +- .../Compose/Layers/HitObjectMaskLayer.cs | 24 +++++--- .../Screens/Compose/Layers/MaskContainer.cs | 16 +++++ .../Screens/Compose/Layers/MaskSelection.cs | 10 ++++ 20 files changed, 426 insertions(+), 47 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs create mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs create mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectMaskLayer.cs create mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectStageMaskLayer.cs create mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs create mode 100644 osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs create mode 100644 osu.Game/Rulesets/Edit/Types/IHasEditableColumn.cs create mode 100644 osu.Game/Rulesets/Edit/Types/IHasEditableLayer.cs rename {osu.Game.Rulesets.Mania => osu.Game/Rulesets}/Objects/Types/IHasColumn.cs (90%) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs new file mode 100644 index 0000000000..3106fedb30 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -0,0 +1,50 @@ +// 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.Framework.Graphics.Primitives; +using osu.Game.Graphics; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Rulesets.Mania.Objects.Drawables; +using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays +{ + public class HoldNoteMask : HitObjectMask + { + private readonly BodyPiece body; + private readonly DrawableHoldNote holdNote; + + public HoldNoteMask(DrawableHoldNote hold) + : base(hold) + { + holdNote = hold; + + Position = hold.Position; + + var holdObject = hold.HitObject; + + InternalChildren = new Drawable[] + { + new NoteMask(hold.Head), + new NoteMask(hold.Tail), + body = new BodyPiece() + { + AccentColour = Color4.Transparent + }, + }; + + holdObject.ColumnChanged += _ => Position = hold.Position; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + body.BorderColour = colours.Yellow; + } + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs new file mode 100644 index 0000000000..1f8d391c99 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs @@ -0,0 +1,29 @@ +// 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.Game.Rulesets.Edit; +using osu.Game.Rulesets.Mania.UI; +using osu.Game.Screens.Edit.Screens.Compose.Layers; + +namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays +{ + public class ManiaHitObjectColumnMaskLayer : HitObjectMaskLayer + { + public readonly Column Column; + + public ManiaHitObjectColumnMaskLayer(ManiaEditPlayfield playfield, HitObjectComposer composer, Column column) + : base(playfield, composer) + { + Column = column; + } + + public void CreateMasks() => AddMasks(); + + protected override void AddMasks() + { + foreach (var obj in Column.HitObjects.Objects) + AddMask(obj); + } + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectMaskLayer.cs new file mode 100644 index 0000000000..012fc495b5 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectMaskLayer.cs @@ -0,0 +1,28 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Edit; +using osu.Game.Screens.Edit.Screens.Compose.Layers; +using System.Collections.Generic; + +namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays +{ + public class ManiaHitObjectMaskLayer : HitObjectMaskLayer + { + public readonly List Stages; + + public ManiaHitObjectMaskLayer(ManiaEditPlayfield playfield, HitObjectComposer composer) + : base(playfield, composer) + { + Stages = new List(); + foreach (var s in ((ManiaEditPlayfield)Playfield).Stages) + Stages.Add(new ManiaHitObjectStageMaskLayer((ManiaEditPlayfield)Playfield, Composer, s)); + } + + protected override void AddMasks() + { + foreach (var s in Stages) + s.CreateMasks(); + } + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectStageMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectStageMaskLayer.cs new file mode 100644 index 0000000000..ae800019c5 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectStageMaskLayer.cs @@ -0,0 +1,31 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Mania.UI; +using osu.Game.Screens.Edit.Screens.Compose.Layers; +using System.Collections.Generic; + +namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays +{ + public class ManiaHitObjectStageMaskLayer : HitObjectMaskLayer + { + public readonly List Columns; + + public ManiaHitObjectStageMaskLayer(ManiaEditPlayfield playfield, HitObjectComposer composer, ManiaStage s) + : base(playfield, composer) + { + Columns = new List(); + foreach (var c in s.Columns) + Columns.Add(new ManiaHitObjectColumnMaskLayer((ManiaEditPlayfield)Playfield, Composer, c)); + } + + public void CreateMasks() => AddMasks(); + + protected override void AddMasks() + { + foreach (var c in Columns) + c.CreateMasks(); + } + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs new file mode 100644 index 0000000000..8228adf35f --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs @@ -0,0 +1,35 @@ +// 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.Game.Graphics; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Mania.Objects.Drawables; +using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; + +namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays +{ + public class NoteMask : HitObjectMask + { + public NoteMask(DrawableNote note) + : base(note) + { + Origin = Anchor.Centre; + + Position = note.Position; + Size = note.Size; + Scale = note.Scale; + + AddInternal(new NotePiece()); + + note.HitObject.ColumnChanged += _ => Position = note.Position; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Colour = colours.Yellow; + } + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs new file mode 100644 index 0000000000..3a2c398e84 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -0,0 +1,58 @@ +// 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.Beatmaps; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Edit.Tools; +using osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays; +using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Rulesets.Mania.Objects.Drawables; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.UI; +using osu.Game.Screens.Edit.Screens.Compose; +using osu.Game.Screens.Edit.Screens.Compose.Layers; +using System.Collections.Generic; + +namespace osu.Game.Rulesets.Mania.Edit +{ + public class ManiaHitObjectComposer : HitObjectComposer + { + public BindableBeatDivisor BeatDivisor; + public ManiaHitObjectComposer(Ruleset ruleset, BindableBeatDivisor beatDivisor) + : base(ruleset) + { + BeatDivisor = beatDivisor; + } + + protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new ManiaEditRulesetContainer(ruleset, beatmap, BeatDivisor); + + protected override IReadOnlyList CompositionTools => new ICompositionTool[] + { + new HitObjectCompositionTool("Note"), + new HitObjectCompositionTool("Hold"), + }; + + // TODO: According to another proposal, extend this to support multiple layers for mania maps + // The logic could be moving all the layers that the beatmap has simultaneously + // To avoid using too many resources, this could be changed to simply changing the Alpha to something + // between 0.25f to 0.5f for notes that are in other layers (and may be also not selected) + // Will also need a tool to navigate through layers + // Please ignore the comment above, I just wanted to write my thoughts down so that I do not forget in 2 months when I get around to it + + public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject) + { + switch (hitObject) + { + case DrawableNote note: + return new NoteMask(note); + case DrawableHoldNote holdNote: + return new HoldNoteMask(holdNote); + } + + return base.CreateMaskFor(hitObject); + } + + protected override HitObjectMaskLayer CreateHitObjectMaskLayer() => new ManiaHitObjectMaskLayer((ManiaEditPlayfield)RulesetContainer.Playfield, this); + } +} diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index 8791e8ed86..2f2d1abe6b 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -18,8 +18,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables /// public class DrawableHoldNote : DrawableManiaHitObject, IKeyBindingHandler { - private readonly DrawableNote head; - private readonly DrawableNote tail; + public readonly DrawableNote Head; + public readonly DrawableNote Tail; private readonly GlowPiece glowPiece; private readonly BodyPiece bodyPiece; @@ -64,12 +64,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables HoldStartTime = () => holdStartTime }) }, - head = new DrawableHeadNote(this, action) + Head = new DrawableHeadNote(this, action) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre }, - tail = new DrawableTailNote(this, action) + Tail = new DrawableTailNote(this, action) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre @@ -79,8 +79,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables foreach (var tick in tickContainer) AddNested(tick); - AddNested(head); - AddNested(tail); + AddNested(Head); + AddNested(Tail); } public override Color4 AccentColour @@ -92,8 +92,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables glowPiece.AccentColour = value; bodyPiece.AccentColour = value; - head.AccentColour = value; - tail.AccentColour = value; + Head.AccentColour = value; + Tail.AccentColour = value; } } @@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { - if (tail.AllJudged) + if (Tail.AllJudged) AddJudgement(new HoldNoteJudgement { Result = HitResult.Perfect }); } @@ -119,12 +119,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables base.Update(); // Make the body piece not lie under the head note - bodyPiece.Y = head.Height; - bodyPiece.Height = DrawHeight - head.Height; + bodyPiece.Y = Head.Height; + bodyPiece.Height = DrawHeight - Head.Height; // Make the fullHeightContainer "contain" the height of the tail note, keeping in mind // that the tail note overshoots the height of this hit object - fullHeightContainer.Height = DrawHeight + tail.Height; + fullHeightContainer.Height = DrawHeight + Tail.Height; } public bool OnPressed(ManiaAction action) @@ -156,7 +156,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables holdStartTime = null; // If the key has been released too early, the user should not receive full score for the release - if (!tail.IsHit) + if (!Tail.IsHit) hasBroken = true; return true; diff --git a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs index e183098a51..8b7191c4c4 100644 --- a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs @@ -1,14 +1,42 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Mania.Objects.Types; +using osu.Game.Rulesets.Edit.Types; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Types; +using System; namespace osu.Game.Rulesets.Mania.Objects { - public abstract class ManiaHitObject : HitObject, IHasColumn + public abstract class ManiaHitObject : HitObject, IHasColumn, IHasLayer, IHasXPosition, IHasEditableColumn, IHasEditableLayer { - public virtual int Column { get; set; } + public event Action ColumnChanged; + + private int column { get; set; } + + public virtual int Column + { + get => column; + set + { + if (column == value) + return; + column = value; + + ColumnChanged?.Invoke(value); + } + } + + public virtual int Layer { get; set; } + + public virtual float X + { + get => Column; + } + + public virtual void OffsetColumn(int offset) => Column += offset; + + public virtual void OffsetLayer(int offset) => Layer += offset; protected override HitWindows CreateHitWindows() => new ManiaHitWindows(); } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 4b936fc7f9..ae931e2f66 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -1,19 +1,19 @@ // 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.Configuration; using osu.Framework.Graphics; -using osu.Game.Rulesets.Mania.Objects; using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Mania.Beatmaps; +using osu.Game.Rulesets.Mania.Configuration; +using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.UI.Scrolling; using System; using System.Collections.Generic; using System.Linq; -using osu.Framework.Allocation; -using osu.Framework.Configuration; -using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Mania.Beatmaps; -using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Mania.Configuration; -using osu.Game.Rulesets.UI.Scrolling; namespace osu.Game.Rulesets.Mania.UI { @@ -25,7 +25,11 @@ namespace osu.Game.Rulesets.Mania.UI public readonly Bindable Inverted = new Bindable(true); public List Columns => stages.SelectMany(x => x.Columns).ToList(); + private readonly List stages = new List(); + public IReadOnlyList Stages => stages; + + protected virtual bool DisplayJudgements => true; public ManiaPlayfield(List stageDefinitions) : base(ScrollingDirection.Up) @@ -50,7 +54,8 @@ namespace osu.Game.Rulesets.Mania.UI int firstColumnIndex = 0; for (int i = 0; i < stageDefinitions.Count; i++) { - var newStage = new ManiaStage(firstColumnIndex, stageDefinitions[i], ref normalColumnAction, ref specialColumnAction); + var newStage = CreateStage(firstColumnIndex, stageDefinitions[i], ref normalColumnAction, ref specialColumnAction); + newStage.DisplayJudgements = DisplayJudgements; newStage.VisibleTimeRange.BindTo(VisibleTimeRange); newStage.Inverted.BindTo(Inverted); @@ -63,7 +68,11 @@ namespace osu.Game.Rulesets.Mania.UI } } - public override void Add(DrawableHitObject h) => getStageByColumn(((ManiaHitObject)h.HitObject).Column).Add(h); + public override void Add(DrawableHitObject h) + { + h.OnJudgement += OnJudgement; + getStageByColumn(((ManiaHitObject)h.HitObject).Column).Add(h); + } public void Add(BarLine barline) => stages.ForEach(s => s.Add(barline)); @@ -88,7 +97,13 @@ namespace osu.Game.Rulesets.Mania.UI internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) { + if (!judgedObject.DisplayJudgement || !DisplayJudgements) + return; + getStageByColumn(((ManiaHitObject)judgedObject.HitObject).Column).OnJudgement(judgedObject, judgement); } + + protected virtual ManiaStage CreateStage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction) + => new ManiaStage(firstColumnIndex, definition, ref normalColumnStartAction, ref specialColumnStartAction); } } diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index a086da0565..1d95dbf004 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -10,4 +10,7 @@ + + + \ No newline at end of file diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 5f1b9a6bad..545c152bbd 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Edit protected ICompositionTool CurrentTool { get; private set; } - private RulesetContainer rulesetContainer; + protected RulesetContainer RulesetContainer; private readonly List layerContainers = new List(); private readonly Bindable beatmap = new Bindable(); @@ -44,8 +44,8 @@ namespace osu.Game.Rulesets.Edit try { - rulesetContainer = CreateRulesetContainer(ruleset, beatmap.Value); - rulesetContainer.Clock = framedClock; + RulesetContainer = CreateRulesetContainer(ruleset, beatmap.Value); + RulesetContainer.Clock = framedClock; } catch (Exception e) { @@ -60,7 +60,7 @@ namespace osu.Game.Rulesets.Edit }; var layerAboveRuleset = CreateLayerContainer(); - layerAboveRuleset.Child = new HitObjectMaskLayer(rulesetContainer.Playfield, this); + layerAboveRuleset.Child = CreateHitObjectMaskLayer(); layerContainers.Add(layerBelowRuleset); layerContainers.Add(layerAboveRuleset); @@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Edit Children = new Drawable[] { layerBelowRuleset, - rulesetContainer, + RulesetContainer, layerAboveRuleset } } @@ -116,13 +116,14 @@ namespace osu.Game.Rulesets.Edit layerContainers.ForEach(l => { - l.Anchor = rulesetContainer.Playfield.Anchor; - l.Origin = rulesetContainer.Playfield.Origin; - l.Position = rulesetContainer.Playfield.Position; - l.Size = rulesetContainer.Playfield.Size; + l.Anchor = RulesetContainer.Playfield.Anchor; + l.Origin = RulesetContainer.Playfield.Origin; + l.Position = RulesetContainer.Playfield.Position; + l.Size = RulesetContainer.Playfield.Size; }); } + private void setCompositionTool(ICompositionTool tool) => CurrentTool = tool; protected virtual RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => ruleset.CreateRulesetContainerWith(beatmap); @@ -141,6 +142,11 @@ namespace osu.Game.Rulesets.Edit /// public virtual MaskSelection CreateMaskSelection() => new MaskSelection(); + /// + /// Creates a depending on the ruleset. + /// + protected virtual HitObjectMaskLayer CreateHitObjectMaskLayer() => new HitObjectMaskLayer(RulesetContainer.Playfield, this); + /// /// Creates a which provides a layer above or below the . /// diff --git a/osu.Game/Rulesets/Edit/HitObjectMask.cs b/osu.Game/Rulesets/Edit/HitObjectMask.cs index 61fb700dd3..3caa4d9fbf 100644 --- a/osu.Game/Rulesets/Edit/HitObjectMask.cs +++ b/osu.Game/Rulesets/Edit/HitObjectMask.cs @@ -33,11 +33,21 @@ namespace osu.Game.Rulesets.Edit /// public event Action SelectionRequested; + /// + /// Invoked when this has started drag. + /// + public event Action DragStarted; + /// /// Invoked when this has requested drag. /// public event Action DragRequested; + /// + /// Invoked when this has ended drag. + /// + public event Action DragEnded; + /// /// The which this applies to. /// @@ -120,7 +130,11 @@ namespace osu.Game.Rulesets.Edit return base.OnClick(state); } - protected override bool OnDragStart(InputState state) => true; + protected override bool OnDragStart(InputState state) + { + DragStarted?.Invoke(this, state); + return true; + } protected override bool OnDrag(InputState state) { @@ -128,6 +142,12 @@ namespace osu.Game.Rulesets.Edit return true; } + protected override bool OnDragEnd(InputState state) + { + DragEnded?.Invoke(this, state); + return true; + } + /// /// The screen-space point that causes this to be selected. /// diff --git a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs index 2c3720fc8f..9c3f99127d 100644 --- a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs +++ b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using osu.Framework.Input; using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Edit.Tools @@ -8,6 +10,18 @@ namespace osu.Game.Rulesets.Edit.Tools public class HitObjectCompositionTool : ICompositionTool where T : HitObject { - public string Name => typeof(T).Name; + public string Name { get; } = typeof(T).Name; + + public Action OnMouseDown { get; } + public Action OnMouseUp { get; } + + public HitObjectCompositionTool() + { + } + + public HitObjectCompositionTool(string name) + { + Name = name; + } } } diff --git a/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs b/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs index ce8b139b43..456c7e6fb3 100644 --- a/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs +++ b/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs @@ -1,10 +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.Input; +using System; + namespace osu.Game.Rulesets.Edit.Tools { public interface ICompositionTool { string Name { get; } + + Action OnMouseDown { get; } + Action OnMouseUp { get; } } } diff --git a/osu.Game/Rulesets/Edit/Types/IHasEditableColumn.cs b/osu.Game/Rulesets/Edit/Types/IHasEditableColumn.cs new file mode 100644 index 0000000000..2691223476 --- /dev/null +++ b/osu.Game/Rulesets/Edit/Types/IHasEditableColumn.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.Types; + +namespace osu.Game.Rulesets.Edit.Types +{ + public interface IHasEditableColumn : IHasColumn + { + void OffsetColumn(int offset); + } +} diff --git a/osu.Game/Rulesets/Edit/Types/IHasEditableLayer.cs b/osu.Game/Rulesets/Edit/Types/IHasEditableLayer.cs new file mode 100644 index 0000000000..3c886caba8 --- /dev/null +++ b/osu.Game/Rulesets/Edit/Types/IHasEditableLayer.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.Types; + +namespace osu.Game.Rulesets.Edit.Types +{ + public interface IHasEditableLayer : IHasLayer + { + void OffsetLayer(int offset); + } +} diff --git a/osu.Game.Rulesets.Mania/Objects/Types/IHasColumn.cs b/osu.Game/Rulesets/Objects/Types/IHasColumn.cs similarity index 90% rename from osu.Game.Rulesets.Mania/Objects/Types/IHasColumn.cs rename to osu.Game/Rulesets/Objects/Types/IHasColumn.cs index 44a79de7db..ba9c7ac933 100644 --- a/osu.Game.Rulesets.Mania/Objects/Types/IHasColumn.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasColumn.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Rulesets.Mania.Objects.Types +namespace osu.Game.Rulesets.Objects.Types { /// /// A type of hit object which lies in one of a number of predetermined columns. diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index b9a8e9914a..5339be7d57 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -14,17 +14,17 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers { public class HitObjectMaskLayer : CompositeDrawable { - private readonly Playfield playfield; - private readonly HitObjectComposer composer; + protected readonly Playfield Playfield; + protected readonly HitObjectComposer Composer; private MaskContainer maskContainer; public HitObjectMaskLayer(Playfield playfield, HitObjectComposer composer) { // we need the playfield as HitObjects may not be initialised until its BDL. - this.playfield = playfield; + this.Playfield = playfield; - this.composer = composer; + this.Composer = composer; RelativeSizeAxes = Axes.Both; } @@ -34,12 +34,14 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers { maskContainer = new MaskContainer(); - var maskSelection = composer.CreateMaskSelection(); + var maskSelection = Composer.CreateMaskSelection(); maskContainer.MaskSelected += maskSelection.HandleSelected; maskContainer.MaskDeselected += maskSelection.HandleDeselected; maskContainer.MaskSelectionRequested += maskSelection.HandleSelectionRequested; + maskContainer.MaskDragStarted += maskSelection.HandleDragStart; maskContainer.MaskDragRequested += maskSelection.HandleDrag; + maskContainer.MaskDragEnded += maskSelection.HandleDragEnd; maskSelection.DeselectAll = maskContainer.DeselectAll; @@ -53,9 +55,13 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers maskContainer, dragLayer.CreateProxy() }; + AddMasks(); + } - foreach (var obj in playfield.HitObjects.Objects) - addMask(obj); + protected virtual void AddMasks() + { + foreach (var obj in Playfield.HitObjects.Objects) + AddMask(obj); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) @@ -68,9 +74,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// Adds a mask for a which adds movement support. /// /// The to create a mask for. - private void addMask(DrawableHitObject hitObject) + protected void AddMask(DrawableHitObject hitObject) { - var mask = composer.CreateMaskFor(hitObject); + var mask = Composer.CreateMaskFor(hitObject); if (mask == null) return; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs index df2691c28e..bce6d876be 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs @@ -29,11 +29,21 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// public event Action MaskSelectionRequested; + /// + /// Invoked when any starts drag. + /// + public event Action MaskDragStarted; + /// /// Invoked when any requests drag. /// public event Action MaskDragRequested; + /// + /// Invoked when any ends drag. + /// + public event Action MaskDragEnded; + private IEnumerable aliveMasks => AliveInternalChildren.Cast(); public MaskContainer() @@ -50,7 +60,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers drawable.Selected += onMaskSelected; drawable.Deselected += onMaskDeselected; drawable.SelectionRequested += onSelectionRequested; + drawable.DragStarted += onDragStarted; drawable.DragRequested += onDragRequested; + drawable.DragEnded += onDragEnded; } public override bool Remove(HitObjectMask drawable) @@ -64,7 +76,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers drawable.Selected -= onMaskSelected; drawable.Deselected -= onMaskDeselected; drawable.SelectionRequested -= onSelectionRequested; + drawable.DragStarted -= onDragStarted; drawable.DragRequested -= onDragRequested; + drawable.DragEnded -= onDragEnded; } return result; @@ -103,7 +117,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers } private void onSelectionRequested(HitObjectMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state); + private void onDragStarted(HitObjectMask mask, InputState state) => MaskDragStarted?.Invoke(mask, state); private void onDragRequested(HitObjectMask mask, InputState state) => MaskDragRequested?.Invoke(mask, state); + private void onDragEnded(HitObjectMask mask, InputState state) => MaskDragEnded?.Invoke(mask, state); protected override int Compare(Drawable x, Drawable y) { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs index 54697bad77..7cd77eeb1c 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs @@ -25,6 +25,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers private readonly List selectedMasks; private Drawable outline; + private Vector2 startingPosition; public MaskSelection() { @@ -54,6 +55,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers #region User Input Handling + public void HandleDragStart(HitObjectMask m, InputState state) => startingPosition = state.Mouse.Position; public void HandleDrag(HitObjectMask m, InputState state) { // Todo: Various forms of snapping @@ -65,9 +67,17 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers case IHasEditablePosition editablePosition: editablePosition.OffsetPosition(state.Mouse.Delta); break; + case IHasEditableColumn editableColumn: + if (IsDragged) + editableColumn.OffsetColumn((int)((startingPosition.X - state.Mouse.Position.X) / m.Width)); // Perform snapping, needs fixing + break; } } } + public void HandleDragEnd(HitObjectMask m, InputState state) + { + + } #endregion From 61a18b952fef7ced177f3928680e24e374f0955b Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Mon, 21 May 2018 23:24:10 +0300 Subject: [PATCH 010/304] Remove useless things --- osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs | 2 +- osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaStage.cs | 4 +++- osu.Game/Rulesets/Edit/Types/IHasEditableLayer.cs | 12 ------------ 4 files changed, 5 insertions(+), 15 deletions(-) delete mode 100644 osu.Game/Rulesets/Edit/Types/IHasEditableLayer.cs diff --git a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs index 8b7191c4c4..aeb998b694 100644 --- a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs @@ -8,7 +8,7 @@ using System; namespace osu.Game.Rulesets.Mania.Objects { - public abstract class ManiaHitObject : HitObject, IHasColumn, IHasLayer, IHasXPosition, IHasEditableColumn, IHasEditableLayer + public abstract class ManiaHitObject : HitObject, IHasColumn, IHasXPosition, IHasEditableColumn { public event Action ColumnChanged; diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs index 6566d44ef5..233e4420f7 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs @@ -8,7 +8,7 @@ using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Mania.UI { - internal class DrawableManiaJudgement : DrawableJudgement + public class DrawableManiaJudgement : DrawableJudgement { public DrawableManiaJudgement(Judgement judgement, DrawableHitObject judgedObject) : base(judgement, judgedObject) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs index 904be3a9e3..53631838ba 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Mania.UI /// /// A collection of s. /// - internal class ManiaStage : ScrollingPlayfield + public class ManiaStage : ScrollingPlayfield { public const float HIT_TARGET_POSITION = 50; @@ -34,6 +34,8 @@ namespace osu.Game.Rulesets.Mania.UI /// public readonly Bindable Inverted = new Bindable(true); + public bool DisplayJudgements = true; + public IReadOnlyList Columns => columnFlow.Children; private readonly FillFlowContainer columnFlow; diff --git a/osu.Game/Rulesets/Edit/Types/IHasEditableLayer.cs b/osu.Game/Rulesets/Edit/Types/IHasEditableLayer.cs deleted file mode 100644 index 3c886caba8..0000000000 --- a/osu.Game/Rulesets/Edit/Types/IHasEditableLayer.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.Types; - -namespace osu.Game.Rulesets.Edit.Types -{ - public interface IHasEditableLayer : IHasLayer - { - void OffsetLayer(int offset); - } -} From 44cf2aa7a3bf0667812661992a7e646e67a425a0 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 22 May 2018 09:00:11 +0300 Subject: [PATCH 011/304] Sync changes on composition tools --- osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs | 7 +++++-- osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs | 6 ------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs index 9c3f99127d..91062a211e 100644 --- a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs +++ b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs @@ -12,8 +12,11 @@ namespace osu.Game.Rulesets.Edit.Tools { public string Name { get; } = typeof(T).Name; - public Action OnMouseDown { get; } - public Action OnMouseUp { get; } + public Func OnMouseDown; + public Func OnMouseUp; + public Func OnDragStart; + public Func OnDragRequested; + public Func OnDragEnd; public HitObjectCompositionTool() { diff --git a/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs b/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs index 456c7e6fb3..ce8b139b43 100644 --- a/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs +++ b/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs @@ -1,16 +1,10 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Input; -using System; - namespace osu.Game.Rulesets.Edit.Tools { public interface ICompositionTool { string Name { get; } - - Action OnMouseDown { get; } - Action OnMouseUp { get; } } } From bbe7765a95d7a8ece6dedaffc6edeff74ae1696b Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 22 May 2018 09:03:47 +0300 Subject: [PATCH 012/304] Add files to not require dependencies from #2534 --- .../Edit/ManiaEditPlayfield.cs | 29 +++++ .../Edit/ManiaEditRulesetContainer.cs | 102 ++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs create mode 100644 osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs new file mode 100644 index 0000000000..15ab4be52b --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs @@ -0,0 +1,29 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Mania.Beatmaps; +using osu.Game.Rulesets.Mania.UI; +using System.Collections.Generic; +using System.Linq; + +namespace osu.Game.Rulesets.Mania.Edit +{ + public class ManiaEditPlayfield : ManiaPlayfield + { + protected override bool DisplayJudgements => false; + + public ManiaEditPlayfield(List stages) + : base(stages) + { + } + + public void Add(EditSnapLine editSnapLine) => Stages.Cast().ForEach(s => s.Add(editSnapLine)); + public void Remove(DrawableManiaEditSnapLine editSnapLine) => Stages.Cast().ForEach(s => s.Remove(editSnapLine)); + public void ClearEditSnapLines() => Stages.Cast().ForEach(s => s.ClearEditSnapLines()); + + protected override ManiaStage CreateStage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction) + => new ManiaEditStage(firstColumnIndex, definition, ref normalColumnStartAction, ref specialColumnStartAction); + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs new file mode 100644 index 0000000000..49c13044e9 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs @@ -0,0 +1,102 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Graphics.Cursor; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Mania.UI; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.UI; +using osu.Game.Screens.Edit.Screens.Compose; +using System.Collections.Generic; +using System.Linq; + +namespace osu.Game.Rulesets.Mania.Edit +{ + public class ManiaEditRulesetContainer : ManiaRulesetContainer + { + public BindableBeatDivisor BeatDivisor; + + public List EditSnapLines; + + public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor) + : base(ruleset, beatmap) + { + BeatDivisor = beatDivisor; + } + + [BackgroundDependencyLoader] + private void load() + { + BeatDivisor.ValueChanged += OnBeatSnapDivisorChange; + OnBeatSnapDivisorChange(BeatDivisor.Value); + } + + public void OnBeatSnapDivisorChange(int newDivisor) + { + generateEditSnapLines(newDivisor); + } + + private void generateEditSnapLines(int newDivisor) + { + // Generate the edit lines + double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue; + + var timingPoints = Beatmap.ControlPointInfo.TimingPoints; + EditSnapLines = new List(); + + // Create lines before the beginning of the first timing point + if (timingPoints.Any()) + { + double step = timingPoints[0].BeatLength / newDivisor; + int index = (int)(timingPoints[0].Time / step); + index += newDivisor - index % newDivisor - 1; + for (double t = timingPoints[0].Time - step; t >= 0; t -= step, index--) + { + EditSnapLines.Add(new EditSnapLine + { + StartTime = t, + ControlPoint = timingPoints[0], + BeatDivisor = BeatDivisor, + BeatIndex = index, + }); + } + } + + for (int i = 0; i < timingPoints.Count; i++) + { + TimingControlPoint point = timingPoints[i]; + + // Stop 1ms before the end of the timing point before the next one if any, otherwise stop at the last object's time + double endTime = i < timingPoints.Count - 1 ? timingPoints[i + 1].Time - 1 : lastObjectTime + point.BeatLength * (int)point.TimeSignature; + + int index = 0; + double step = point.BeatLength / newDivisor; + for (double t = timingPoints[i].Time; t <= endTime; t += step, index++) + { + EditSnapLines.Add(new EditSnapLine + { + StartTime = t, + ControlPoint = point, + BeatDivisor = BeatDivisor, + BeatIndex = index, + }); + } + } + + var editPlayfield = (ManiaEditPlayfield)Playfield; + + editPlayfield.ClearEditSnapLines(); + EditSnapLines.ForEach(editPlayfield.Add); + } + + protected override Playfield CreatePlayfield() => new ManiaEditPlayfield(Beatmap.Stages); + + protected override Vector2 PlayfieldArea => Vector2.One; + + protected override CursorContainer CreateCursor() => null; + } +} From 2769f6c47bd794c5b97f963846d1bdedf9ff729e Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 22 May 2018 09:09:25 +0300 Subject: [PATCH 013/304] Fix issues --- .../Edit/Layers/Selection/Overlays/HoldNoteMask.cs | 5 +---- .../Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs | 1 - osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs | 8 -------- .../Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs | 4 ++-- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs index 3106fedb30..ea28d24752 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -3,13 +3,10 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Primitives; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; -using OpenTK; using OpenTK.Graphics; namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays @@ -32,7 +29,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays { new NoteMask(hold.Head), new NoteMask(hold.Tail), - body = new BodyPiece() + body = new BodyPiece { AccentColour = Color4.Transparent }, diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs index 1f8d391c99..6886ff83f7 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.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 osu.Framework.Allocation; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.UI; using osu.Game.Screens.Edit.Screens.Compose.Layers; diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 3a2c398e84..f0e0f27818 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.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 osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; @@ -33,13 +32,6 @@ namespace osu.Game.Rulesets.Mania.Edit new HitObjectCompositionTool("Hold"), }; - // TODO: According to another proposal, extend this to support multiple layers for mania maps - // The logic could be moving all the layers that the beatmap has simultaneously - // To avoid using too many resources, this could be changed to simply changing the Alpha to something - // between 0.25f to 0.5f for notes that are in other layers (and may be also not selected) - // Will also need a tool to navigate through layers - // Please ignore the comment above, I just wanted to write my thoughts down so that I do not forget in 2 months when I get around to it - public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject) { switch (hitObject) diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index 5339be7d57..ffef177d00 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -22,9 +22,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers public HitObjectMaskLayer(Playfield playfield, HitObjectComposer composer) { // we need the playfield as HitObjects may not be initialised until its BDL. - this.Playfield = playfield; + Playfield = playfield; - this.Composer = composer; + Composer = composer; RelativeSizeAxes = Axes.Both; } From 8aac1f50eea9127de3db49151fbea11dffd9274c Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 22 May 2018 09:12:22 +0300 Subject: [PATCH 014/304] Remove more dependencies --- .../Edit/ManiaEditRulesetContainer.cs | 61 ------------------- .../UI/ManiaRulesetContainer.cs | 2 +- 2 files changed, 1 insertion(+), 62 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs index 49c13044e9..442997f1f3 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs @@ -5,14 +5,9 @@ using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics.Cursor; using osu.Game.Beatmaps; -using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.UI; -using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.UI; using osu.Game.Screens.Edit.Screens.Compose; -using System.Collections.Generic; -using System.Linq; namespace osu.Game.Rulesets.Mania.Edit { @@ -20,8 +15,6 @@ namespace osu.Game.Rulesets.Mania.Edit { public BindableBeatDivisor BeatDivisor; - public List EditSnapLines; - public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor) : base(ruleset, beatmap) { @@ -37,60 +30,6 @@ namespace osu.Game.Rulesets.Mania.Edit public void OnBeatSnapDivisorChange(int newDivisor) { - generateEditSnapLines(newDivisor); - } - - private void generateEditSnapLines(int newDivisor) - { - // Generate the edit lines - double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue; - - var timingPoints = Beatmap.ControlPointInfo.TimingPoints; - EditSnapLines = new List(); - - // Create lines before the beginning of the first timing point - if (timingPoints.Any()) - { - double step = timingPoints[0].BeatLength / newDivisor; - int index = (int)(timingPoints[0].Time / step); - index += newDivisor - index % newDivisor - 1; - for (double t = timingPoints[0].Time - step; t >= 0; t -= step, index--) - { - EditSnapLines.Add(new EditSnapLine - { - StartTime = t, - ControlPoint = timingPoints[0], - BeatDivisor = BeatDivisor, - BeatIndex = index, - }); - } - } - - for (int i = 0; i < timingPoints.Count; i++) - { - TimingControlPoint point = timingPoints[i]; - - // Stop 1ms before the end of the timing point before the next one if any, otherwise stop at the last object's time - double endTime = i < timingPoints.Count - 1 ? timingPoints[i + 1].Time - 1 : lastObjectTime + point.BeatLength * (int)point.TimeSignature; - - int index = 0; - double step = point.BeatLength / newDivisor; - for (double t = timingPoints[i].Time; t <= endTime; t += step, index++) - { - EditSnapLines.Add(new EditSnapLine - { - StartTime = t, - ControlPoint = point, - BeatDivisor = BeatDivisor, - BeatIndex = index, - }); - } - } - - var editPlayfield = (ManiaEditPlayfield)Playfield; - - editPlayfield.ClearEditSnapLines(); - EditSnapLines.ForEach(editPlayfield.Add); } protected override Playfield CreatePlayfield() => new ManiaEditPlayfield(Beatmap.Stages); diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index 7123aab901..6618125176 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Mania.UI BarLines.ForEach(Playfield.Add); } - protected sealed override Playfield CreatePlayfield() => new ManiaPlayfield(Beatmap.Stages) + protected override Playfield CreatePlayfield() => new ManiaPlayfield(Beatmap.Stages) { Anchor = Anchor.Centre, Origin = Anchor.Centre, From a178c44b60e578cf654d57d2a98361d94d147737 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 22 May 2018 09:12:51 +0300 Subject: [PATCH 015/304] Remove snap line dependencies --- osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs index 15ab4be52b..30ff591359 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs @@ -1,12 +1,9 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.UI; using System.Collections.Generic; -using System.Linq; namespace osu.Game.Rulesets.Mania.Edit { @@ -19,10 +16,6 @@ namespace osu.Game.Rulesets.Mania.Edit { } - public void Add(EditSnapLine editSnapLine) => Stages.Cast().ForEach(s => s.Add(editSnapLine)); - public void Remove(DrawableManiaEditSnapLine editSnapLine) => Stages.Cast().ForEach(s => s.Remove(editSnapLine)); - public void ClearEditSnapLines() => Stages.Cast().ForEach(s => s.ClearEditSnapLines()); - protected override ManiaStage CreateStage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction) => new ManiaEditStage(firstColumnIndex, definition, ref normalColumnStartAction, ref specialColumnStartAction); } From c7dfe88ad2229aaf4bdbaaa3953846489a1d3228 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 22 May 2018 09:18:02 +0300 Subject: [PATCH 016/304] Complete PR's independence --- .../Layers/Selection/Overlays/HoldNoteMask.cs | 3 --- osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs | 16 ++++++++++++++++ .../Objects/ManiaHitObject.cs | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs index ea28d24752..0b468515d3 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -14,13 +14,10 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays public class HoldNoteMask : HitObjectMask { private readonly BodyPiece body; - private readonly DrawableHoldNote holdNote; public HoldNoteMask(DrawableHoldNote hold) : base(hold) { - holdNote = hold; - Position = hold.Position; var holdObject = hold.HitObject; diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs new file mode 100644 index 0000000000..9068725023 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Mania.Beatmaps; +using osu.Game.Rulesets.Mania.UI; + +namespace osu.Game.Rulesets.Mania.Edit +{ + public class ManiaEditStage : ManiaStage + { + public ManiaEditStage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction) + : base(firstColumnIndex, definition, ref normalColumnStartAction, ref specialColumnStartAction) + { + } + } +} diff --git a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs index aeb998b694..4d28c39faa 100644 --- a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs @@ -8,7 +8,7 @@ using System; namespace osu.Game.Rulesets.Mania.Objects { - public abstract class ManiaHitObject : HitObject, IHasColumn, IHasXPosition, IHasEditableColumn + public abstract class ManiaHitObject : HitObject, IHasXPosition, IHasEditableColumn { public event Action ColumnChanged; From f715734662ee56224ac061790587b18d73aac4a7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 7 Jun 2018 15:57:21 +0900 Subject: [PATCH 017/304] Remove unnecessary csproj edit --- osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index 1d95dbf004..a086da0565 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -10,7 +10,4 @@ - - - \ No newline at end of file From 279a2844f045e7d699f88148c264d9fd38463709 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 7 Jun 2018 16:08:37 +0900 Subject: [PATCH 018/304] Actually make ManiaHitObjectComposer constructible/testable --- .../TestCaseEditor.cs | 17 +++++++++++++++++ .../Edit/ManiaEditRulesetContainer.cs | 18 +----------------- .../Edit/ManiaHitObjectComposer.cs | 7 ++----- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 4 ++++ 4 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs new file mode 100644 index 0000000000..799bb9efd8 --- /dev/null +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using NUnit.Framework; +using osu.Game.Tests.Visual; + +namespace osu.Game.Rulesets.Mania.Tests +{ + [TestFixture] + public class TestCaseEditor : EditorTestCase + { + public TestCaseEditor() + : base(new ManiaRuleset()) + { + } + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs index 442997f1f3..71ec668531 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs @@ -2,33 +2,17 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Framework.Allocation; using osu.Framework.Graphics.Cursor; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.UI; -using osu.Game.Screens.Edit.Screens.Compose; namespace osu.Game.Rulesets.Mania.Edit { public class ManiaEditRulesetContainer : ManiaRulesetContainer { - public BindableBeatDivisor BeatDivisor; - - public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor) + public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) - { - BeatDivisor = beatDivisor; - } - - [BackgroundDependencyLoader] - private void load() - { - BeatDivisor.ValueChanged += OnBeatSnapDivisorChange; - OnBeatSnapDivisorChange(BeatDivisor.Value); - } - - public void OnBeatSnapDivisorChange(int newDivisor) { } diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index f0e0f27818..d04c70ae16 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -9,7 +9,6 @@ using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; -using osu.Game.Screens.Edit.Screens.Compose; using osu.Game.Screens.Edit.Screens.Compose.Layers; using System.Collections.Generic; @@ -17,14 +16,12 @@ namespace osu.Game.Rulesets.Mania.Edit { public class ManiaHitObjectComposer : HitObjectComposer { - public BindableBeatDivisor BeatDivisor; - public ManiaHitObjectComposer(Ruleset ruleset, BindableBeatDivisor beatDivisor) + public ManiaHitObjectComposer(Ruleset ruleset) : base(ruleset) { - BeatDivisor = beatDivisor; } - protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new ManiaEditRulesetContainer(ruleset, beatmap, BeatDivisor); + protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new ManiaEditRulesetContainer(ruleset, beatmap); protected override IReadOnlyList CompositionTools => new ICompositionTool[] { diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 02ecb3afda..9d7c37d9e9 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -16,8 +16,10 @@ using osu.Game.Rulesets.Mania.Replays; using osu.Game.Rulesets.Replays.Types; using osu.Game.Beatmaps.Legacy; using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Difficulty; +using osu.Game.Rulesets.Mania.Edit; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mania @@ -28,6 +30,8 @@ namespace osu.Game.Rulesets.Mania public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new ManiaBeatmapConverter(beatmap); public override PerformanceCalculator CreatePerformanceCalculator(IBeatmap beatmap, Score score) => new ManiaPerformanceCalculator(this, beatmap, score); + public override HitObjectComposer CreateHitObjectComposer() => new ManiaHitObjectComposer(this); + public override IEnumerable ConvertLegacyMods(LegacyMods mods) { if (mods.HasFlag(LegacyMods.Nightcore)) From d1b469c1a3b3737e02086a85b4bcd6dfeffb9700 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 7 Jun 2018 16:27:49 +0900 Subject: [PATCH 019/304] Better handling of nested playfields' hitobjects --- .../Overlays/ManiaHitObjectColumnMaskLayer.cs | 28 ----------------- .../Overlays/ManiaHitObjectMaskLayer.cs | 28 ----------------- .../Overlays/ManiaHitObjectStageMaskLayer.cs | 31 ------------------- .../Edit/ManiaHitObjectComposer.cs | 3 -- .../Compose/Layers/HitObjectMaskLayer.cs | 15 ++++++--- 5 files changed, 10 insertions(+), 95 deletions(-) delete mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs delete mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectMaskLayer.cs delete mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectStageMaskLayer.cs diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs deleted file mode 100644 index 6886ff83f7..0000000000 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs +++ /dev/null @@ -1,28 +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.Edit; -using osu.Game.Rulesets.Mania.UI; -using osu.Game.Screens.Edit.Screens.Compose.Layers; - -namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays -{ - public class ManiaHitObjectColumnMaskLayer : HitObjectMaskLayer - { - public readonly Column Column; - - public ManiaHitObjectColumnMaskLayer(ManiaEditPlayfield playfield, HitObjectComposer composer, Column column) - : base(playfield, composer) - { - Column = column; - } - - public void CreateMasks() => AddMasks(); - - protected override void AddMasks() - { - foreach (var obj in Column.HitObjects.Objects) - AddMask(obj); - } - } -} diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectMaskLayer.cs deleted file mode 100644 index 012fc495b5..0000000000 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectMaskLayer.cs +++ /dev/null @@ -1,28 +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.Edit; -using osu.Game.Screens.Edit.Screens.Compose.Layers; -using System.Collections.Generic; - -namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays -{ - public class ManiaHitObjectMaskLayer : HitObjectMaskLayer - { - public readonly List Stages; - - public ManiaHitObjectMaskLayer(ManiaEditPlayfield playfield, HitObjectComposer composer) - : base(playfield, composer) - { - Stages = new List(); - foreach (var s in ((ManiaEditPlayfield)Playfield).Stages) - Stages.Add(new ManiaHitObjectStageMaskLayer((ManiaEditPlayfield)Playfield, Composer, s)); - } - - protected override void AddMasks() - { - foreach (var s in Stages) - s.CreateMasks(); - } - } -} diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectStageMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectStageMaskLayer.cs deleted file mode 100644 index ae800019c5..0000000000 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectStageMaskLayer.cs +++ /dev/null @@ -1,31 +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.Edit; -using osu.Game.Rulesets.Mania.UI; -using osu.Game.Screens.Edit.Screens.Compose.Layers; -using System.Collections.Generic; - -namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays -{ - public class ManiaHitObjectStageMaskLayer : HitObjectMaskLayer - { - public readonly List Columns; - - public ManiaHitObjectStageMaskLayer(ManiaEditPlayfield playfield, HitObjectComposer composer, ManiaStage s) - : base(playfield, composer) - { - Columns = new List(); - foreach (var c in s.Columns) - Columns.Add(new ManiaHitObjectColumnMaskLayer((ManiaEditPlayfield)Playfield, Composer, c)); - } - - public void CreateMasks() => AddMasks(); - - protected override void AddMasks() - { - foreach (var c in Columns) - c.CreateMasks(); - } - } -} diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index d04c70ae16..b1968d0aff 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -9,7 +9,6 @@ using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; -using osu.Game.Screens.Edit.Screens.Compose.Layers; using System.Collections.Generic; namespace osu.Game.Rulesets.Mania.Edit @@ -41,7 +40,5 @@ namespace osu.Game.Rulesets.Mania.Edit return base.CreateMaskFor(hitObject); } - - protected override HitObjectMaskLayer CreateHitObjectMaskLayer() => new ManiaHitObjectMaskLayer((ManiaEditPlayfield)RulesetContainer.Playfield, this); } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index ffef177d00..9444e07f85 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -55,13 +55,18 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers maskContainer, dragLayer.CreateProxy() }; - AddMasks(); + + addMasks(Playfield); } - protected virtual void AddMasks() + private void addMasks(Playfield playfield) { - foreach (var obj in Playfield.HitObjects.Objects) - AddMask(obj); + foreach (var obj in playfield.HitObjects.Objects) + addMask(obj); + + if (playfield.NestedPlayfields != null) + foreach (var p in playfield.NestedPlayfields) + addMasks(p); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) @@ -74,7 +79,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// Adds a mask for a which adds movement support. /// /// The to create a mask for. - protected void AddMask(DrawableHitObject hitObject) + private void addMask(DrawableHitObject hitObject) { var mask = Composer.CreateMaskFor(hitObject); if (mask == null) From cd532cde2d7852d94d8969dbed881c115baec6ae Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 7 Jun 2018 18:28:49 +0900 Subject: [PATCH 020/304] Fix note masks not working --- .../Edit/Layers/Selection/Overlays/NoteMask.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs index 8228adf35f..9f34bb4fa4 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.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 osu.Framework.Graphics; using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; @@ -15,10 +14,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays public NoteMask(DrawableNote note) : base(note) { - Origin = Anchor.Centre; - - Position = note.Position; - Size = note.Size; Scale = note.Scale; AddInternal(new NotePiece()); @@ -31,5 +26,13 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays { Colour = colours.Yellow; } + + protected override void Update() + { + base.Update(); + + Size = HitObject.DrawSize; + Position = Parent.ToLocalSpace(HitObject.ScreenSpaceDrawQuad.BottomLeft); + } } } From f299ae0fbd18541f0078bc7cfac9fc45866c8988 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 7 Jun 2018 18:59:52 +0900 Subject: [PATCH 021/304] Fix positioning --- .../Edit/Layers/ManiaHitObjectMaskLayer.cs | 27 +++++++++++++++++++ .../Layers/Selection/Overlays/NoteMask.cs | 3 ++- .../Edit/ManiaHitObjectComposer.cs | 11 ++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/ManiaHitObjectMaskLayer.cs diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/ManiaHitObjectMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/ManiaHitObjectMaskLayer.cs new file mode 100644 index 0000000000..2bf9cbe6e0 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/Layers/ManiaHitObjectMaskLayer.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Configuration; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.UI; +using osu.Game.Screens.Edit.Screens.Compose.Layers; +using OpenTK; + +namespace osu.Game.Rulesets.Mania.Edit.Layers +{ + public class ManiaHitObjectMaskLayer : HitObjectMaskLayer + { + public readonly IBindable Inverted = new Bindable(); + + public ManiaHitObjectMaskLayer(Playfield playfield, HitObjectComposer composer) + : base(playfield, composer) + { + Inverted.ValueChanged += invertedChanged; + } + + private void invertedChanged(bool newValue) + { + Scale = new Vector2(1, newValue ? -1 : 1); + } + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs index 9f34bb4fa4..d61ef114c5 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Objects.Drawables; @@ -32,7 +33,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays base.Update(); Size = HitObject.DrawSize; - Position = Parent.ToLocalSpace(HitObject.ScreenSpaceDrawQuad.BottomLeft); + Position = Parent.ToLocalSpace(HitObject.ScreenSpaceDrawQuad.TopLeft); } } } diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index b1968d0aff..225f04479d 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -10,6 +10,9 @@ using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; using System.Collections.Generic; +using osu.Game.Rulesets.Mania.Edit.Layers; +using osu.Game.Rulesets.Mania.UI; +using osu.Game.Screens.Edit.Screens.Compose.Layers; namespace osu.Game.Rulesets.Mania.Edit { @@ -40,5 +43,13 @@ namespace osu.Game.Rulesets.Mania.Edit return base.CreateMaskFor(hitObject); } + + protected override HitObjectMaskLayer CreateHitObjectMaskLayer() + { + var layer = new ManiaHitObjectMaskLayer(RulesetContainer.Playfield, this); + layer.Inverted.BindTo(((ManiaPlayfield)RulesetContainer.Playfield).Inverted); + + return layer; + } } } From 24b314b51f9c5c28be61b09fa6f56558c03c8100 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 7 Jun 2018 19:00:02 +0900 Subject: [PATCH 022/304] Fix hold note masks not working --- .../Layers/Selection/Overlays/HoldNoteMask.cs | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs index 0b468515d3..648ec29e64 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -18,14 +18,12 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays public HoldNoteMask(DrawableHoldNote hold) : base(hold) { - Position = hold.Position; - var holdObject = hold.HitObject; InternalChildren = new Drawable[] { - new NoteMask(hold.Head), - new NoteMask(hold.Tail), + new HoldNoteNoteMask(hold.Head), + new HoldNoteNoteMask(hold.Tail), body = new BodyPiece { AccentColour = Color4.Transparent @@ -40,5 +38,29 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays { body.BorderColour = colours.Yellow; } + + protected override void Update() + { + base.Update(); + + Size = HitObject.DrawSize; + Position = Parent.ToLocalSpace(HitObject.ScreenSpaceDrawQuad.TopLeft); + } + + private class HoldNoteNoteMask : NoteMask + { + public HoldNoteNoteMask(DrawableNote note) + : base(note) + { + Select(); + } + + protected override void Update() + { + base.Update(); + + Position = HitObject.DrawPosition; + } + } } } From ce7a5e8914af475684e95d6420d6aa2ff8ff7055 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 7 Jun 2018 19:19:32 +0900 Subject: [PATCH 023/304] Update visual style to match new notes --- .../Edit/Layers/Selection/Overlays/NoteMask.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs index d61ef114c5..8c46e20835 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Objects.Drawables; @@ -17,6 +16,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays { Scale = note.Scale; + CornerRadius = 5; + Masking = true; + AddInternal(new NotePiece()); note.HitObject.ColumnChanged += _ => Position = note.Position; From 99e28b6efa5a9bcfb6b6491ba58ffcc8da767a1d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 17:38:43 +0900 Subject: [PATCH 024/304] No reason for beatmap conversion tests to be internal --- osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs | 4 ++-- osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs | 4 ++-- osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs | 4 ++-- osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs index 5b34e46247..14d913cffa 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs @@ -12,7 +12,7 @@ using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Catch.Tests { - internal class CatchBeatmapConversionTest : BeatmapConversionTest + public class CatchBeatmapConversionTest : BeatmapConversionTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Catch"; @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Catch.Tests protected override Ruleset CreateRuleset() => new CatchRuleset(); } - internal struct ConvertValue : IEquatable + public struct ConvertValue : IEquatable { /// /// A sane value to account for osu!stable using ints everwhere. diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs index 5ae899f6d6..f9e6531119 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs @@ -12,7 +12,7 @@ using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Mania.Tests { - internal class ManiaBeatmapConversionTest : BeatmapConversionTest + public class ManiaBeatmapConversionTest : BeatmapConversionTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Mania"; @@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Mania.Tests protected override Ruleset CreateRuleset() => new ManiaRuleset(); } - internal struct ConvertValue : IEquatable + public struct ConvertValue : IEquatable { /// /// A sane value to account for osu!stable using ints everwhere. diff --git a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs index 386ae5eb05..1383256352 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs @@ -13,7 +13,7 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Tests { - internal class OsuBeatmapConversionTest : BeatmapConversionTest + public class OsuBeatmapConversionTest : BeatmapConversionTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Osu"; @@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Osu.Tests protected override Ruleset CreateRuleset() => new OsuRuleset(); } - internal struct ConvertValue : IEquatable + public struct ConvertValue : IEquatable { /// /// A sane value to account for osu!stable using ints everwhere. diff --git a/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs index 11586e340b..fb0b2040f4 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs @@ -12,7 +12,7 @@ using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Taiko.Tests { - internal class TaikoBeatmapConversionTest : BeatmapConversionTest + public class TaikoBeatmapConversionTest : BeatmapConversionTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Taiko"; @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Taiko.Tests protected override Ruleset CreateRuleset() => new TaikoRuleset(); } - internal struct ConvertValue : IEquatable + public struct ConvertValue : IEquatable { /// /// A sane value to account for osu!stable using ints everwhere. From e94518697833fc60837078492607acadfbab79aa Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 17:59:52 +0900 Subject: [PATCH 025/304] Expose the beatmap converter --- osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs b/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs index cf4dda52a8..b95173e44d 100644 --- a/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs +++ b/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs @@ -25,6 +25,8 @@ namespace osu.Game.Tests.Beatmaps protected abstract string ResourceAssembly { get; } + protected IBeatmapConverter Converter { get; private set; } + protected void Test(string name) { var ourResult = convert(name); @@ -88,10 +90,11 @@ namespace osu.Game.Tests.Beatmaps var rulesetInstance = CreateRuleset(); beatmap.BeatmapInfo.Ruleset = beatmap.BeatmapInfo.RulesetID == rulesetInstance.RulesetInfo.ID ? rulesetInstance.RulesetInfo : new RulesetInfo(); - var result = new ConvertResult(); - var converter = rulesetInstance.CreateBeatmapConverter(beatmap); + Converter = rulesetInstance.CreateBeatmapConverter(beatmap); - converter.ObjectConverted += (orig, converted) => + var result = new ConvertResult(); + + Converter.ObjectConverted += (orig, converted) => { converted.ForEach(h => h.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty)); @@ -103,7 +106,7 @@ namespace osu.Game.Tests.Beatmaps result.Mappings.Add(mapping); }; - IBeatmap convertedBeatmap = converter.Convert(); + IBeatmap convertedBeatmap = Converter.Convert(); rulesetInstance.CreateBeatmapProcessor(convertedBeatmap)?.PostProcess(); return result; From 47ae962099fdb248c6fc547ecb85bd2ee01b6398 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 18:20:28 +0900 Subject: [PATCH 026/304] Output only one mapping failure per mapping --- .../Tests/Beatmaps/BeatmapConversionTest.cs | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs b/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs index b95173e44d..ff57ef41c5 100644 --- a/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs +++ b/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs @@ -43,14 +43,22 @@ namespace osu.Game.Tests.Beatmaps Assert.Fail($"A conversion did not generate any hitobjects, but should have, for hitobject at time: {expectedResult.Mappings[mappingCounter].StartTime}\n"); else if (mappingCounter >= expectedResult.Mappings.Count) Assert.Fail($"A conversion generated hitobjects, but should not have, for hitobject at time: {ourResult.Mappings[mappingCounter].StartTime}\n"); + else if (!expectedResult.Mappings[mappingCounter].Equals(ourResult.Mappings[mappingCounter])) + { + var expectedMapping = expectedResult.Mappings[mappingCounter]; + var ourMapping = ourResult.Mappings[mappingCounter]; + + Assert.Fail($"The conversion mapping differed for object at time {expectedMapping.StartTime}:\n" + + $"Expected {JsonConvert.SerializeObject(expectedMapping)}\n" + + $"Received: {JsonConvert.SerializeObject(ourMapping)}\n"); + } else { - var counter = mappingCounter; + var ourMapping = ourResult.Mappings[mappingCounter]; + var expectedMapping = expectedResult.Mappings[mappingCounter]; + Assert.Multiple(() => { - var ourMapping = ourResult.Mappings[counter]; - var expectedMapping = expectedResult.Mappings[counter]; - int objectCounter = 0; while (true) { @@ -62,10 +70,6 @@ namespace osu.Game.Tests.Beatmaps else if (objectCounter >= expectedMapping.Objects.Count) Assert.Fail($"The conversion generated a hitobject, but should not have, for hitobject at time: {ourMapping.StartTime}:\n" + $"Received: {JsonConvert.SerializeObject(ourMapping.Objects[objectCounter])}\n"); - else if (!expectedMapping.Equals(ourMapping)) - Assert.Fail($"The conversion mapping differed for object at time {expectedMapping.StartTime}:\n" - + $"Expected {JsonConvert.SerializeObject(expectedMapping)}\n" - + $"Received: {JsonConvert.SerializeObject(ourMapping)}\n"); else if (!expectedMapping.Objects[objectCounter].Equals(ourMapping.Objects[objectCounter])) { Assert.Fail($"The conversion generated differing hitobjects for object at time: {expectedMapping.StartTime}:\n" From afbf35b81416ec5e76c6425971ec6ca7677abf74 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 20:48:36 +0900 Subject: [PATCH 027/304] Add rng components to mania conversion tests --- .../ManiaBeatmapConversionTest.cs | 30 ++++++++++++++++++- .../MathUtils/FastRandom.cs | 18 ++++++----- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs index f9e6531119..c13319ace9 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs @@ -5,6 +5,8 @@ using System; using System.Collections.Generic; using NUnit.Framework; using osu.Framework.MathUtils; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; @@ -12,7 +14,7 @@ using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Mania.Tests { - public class ManiaBeatmapConversionTest : BeatmapConversionTest + public class ManiaBeatmapConversionTest : BeatmapConversionTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Mania"; @@ -33,9 +35,35 @@ namespace osu.Game.Rulesets.Mania.Tests }; } + protected override ManiaConvertMapping CreateConvertMapping() => new ManiaConvertMapping(Converter); + protected override Ruleset CreateRuleset() => new ManiaRuleset(); } + public class ManiaConvertMapping : ConvertMapping, IEquatable + { + public uint RandomW; + public uint RandomX; + public uint RandomY; + public uint RandomZ; + + public ManiaConvertMapping() + { + } + + public ManiaConvertMapping(IBeatmapConverter converter) + { + var maniaConverter = (ManiaBeatmapConverter)converter; + RandomW = maniaConverter.Random.W; + RandomX = maniaConverter.Random.X; + RandomY = maniaConverter.Random.Y; + RandomZ = maniaConverter.Random.Z; + } + + public bool Equals(ManiaConvertMapping other) => other != null && RandomW == other.RandomW && RandomX == other.RandomX && RandomY == other.RandomY && RandomZ == other.RandomZ; + public override bool Equals(ConvertMapping other) => base.Equals(other) && Equals(other as ManiaConvertMapping); + } + public struct ConvertValue : IEquatable { /// diff --git a/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs b/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs index a3efd5c2bd..785cd5ab06 100644 --- a/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs +++ b/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs @@ -15,11 +15,15 @@ namespace osu.Game.Rulesets.Mania.MathUtils private const uint y = 842502087; private const uint z = 3579807591; private const uint w = 273326509; - private uint _x, _y = y, _z = z, _w = w; + + internal uint X { get; private set; } + internal uint Y { get; private set; } = y; + internal uint Z { get; private set; } = z; + internal uint W { get; private set; } = w; public FastRandom(int seed) { - _x = (uint)seed; + X = (uint)seed; } public FastRandom() @@ -33,11 +37,11 @@ namespace osu.Game.Rulesets.Mania.MathUtils /// The random value. public uint NextUInt() { - uint t = _x ^ _x << 11; - _x = _y; - _y = _z; - _z = _w; - return _w = _w ^ _w >> 19 ^ t ^ t >> 8; + uint t = X ^ X << 11; + X = Y; + Y = Z; + Z = W; + return W = W ^ W >> 19 ^ t ^ t >> 8; } /// From 481546ec7a76ba80a6e5753f9e40f1c6d94a2b45 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 20:49:11 +0900 Subject: [PATCH 028/304] Fix drain time not being rounded to the second --- .../Beatmaps/Patterns/Legacy/PatternGenerator.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs index 930597c1ad..8ef942c683 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs @@ -103,17 +103,14 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy HitObject lastObject = OriginalBeatmap.HitObjects.LastOrDefault(); HitObject firstObject = OriginalBeatmap.HitObjects.FirstOrDefault(); - double drainTime = (lastObject?.StartTime ?? 0) - (firstObject?.StartTime ?? 0); - drainTime -= OriginalBeatmap.TotalBreakTime; + // Drain time in seconds + int drainTime = (int)(((lastObject?.StartTime ?? 0) - (firstObject?.StartTime ?? 0) - OriginalBeatmap.TotalBreakTime) / 1000); if (drainTime == 0) - drainTime = 10000000; - - // We need this in seconds - drainTime /= 1000; + drainTime = 100000; BeatmapDifficulty difficulty = OriginalBeatmap.BeatmapInfo.BaseDifficulty; - conversionDifficulty = ((difficulty.DrainRate + MathHelper.Clamp(difficulty.ApproachRate, 4, 7)) / 1.5 + OriginalBeatmap.HitObjects.Count() / drainTime * 9f) / 38f * 5f / 1.15; + conversionDifficulty = ((difficulty.DrainRate + MathHelper.Clamp(difficulty.ApproachRate, 4, 7)) / 1.5 + (double)OriginalBeatmap.HitObjects.Count() / drainTime * 9f) / 38f * 5f / 1.15; conversionDifficulty = Math.Min(conversionDifficulty.Value, 12); return conversionDifficulty.Value; From fe9aaf000c97abd7029a129331b14dc62b6bbc62 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 20:50:36 +0900 Subject: [PATCH 029/304] Fix missing conditional --- .../Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index b4160dc98b..1ea2863520 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -82,7 +82,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { if (HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_FINISH) && TotalColumns != 8) convertType |= PatternType.Mirror; - else + else if (HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_CLAP)) convertType |= PatternType.Gathered; } } From c1f7db80f17a013ba313aa3640fe4f21e2d9a604 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 20:52:09 +0900 Subject: [PATCH 030/304] Forgot to commit random change --- .../Beatmaps/ManiaBeatmapConverter.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 19fef9eb54..d76ae4f081 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -28,8 +28,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps public int TargetColumns; public readonly bool IsForCurrentRuleset; + // Internal for testing purposes + internal FastRandom Random { get; private set; } + private Pattern lastPattern = new Pattern(); - private FastRandom random; private ManiaBeatmap beatmap; @@ -62,7 +64,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps BeatmapDifficulty difficulty = original.BeatmapInfo.BaseDifficulty; int seed = (int)Math.Round(difficulty.DrainRate + difficulty.CircleSize) * 20 + (int)(difficulty.OverallDifficulty * 41.2) + (int)Math.Round(difficulty.ApproachRate); - random = new FastRandom(seed); + Random = new FastRandom(seed); return base.ConvertBeatmap(original); } @@ -115,7 +117,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps /// The hit objects generated. private IEnumerable generateSpecific(HitObject original, IBeatmap originalBeatmap) { - var generator = new SpecificBeatmapPatternGenerator(random, original, beatmap, lastPattern, originalBeatmap); + var generator = new SpecificBeatmapPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap); Pattern newPattern = generator.Generate(); lastPattern = newPattern; @@ -138,14 +140,17 @@ namespace osu.Game.Rulesets.Mania.Beatmaps Patterns.PatternGenerator conversion = null; if (distanceData != null) - conversion = new DistanceObjectPatternGenerator(random, original, beatmap, lastPattern, originalBeatmap); + { + var generator = new DistanceObjectPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap); + conversion = generator; + } else if (endTimeData != null) - conversion = new EndTimeObjectPatternGenerator(random, original, beatmap, originalBeatmap); + conversion = new EndTimeObjectPatternGenerator(Random, original, beatmap, originalBeatmap); else if (positionData != null) { computeDensity(original.StartTime); - conversion = new HitObjectPatternGenerator(random, original, beatmap, lastPattern, lastTime, lastPosition, density, lastStair, originalBeatmap); + conversion = new HitObjectPatternGenerator(Random, original, beatmap, lastPattern, lastTime, lastPosition, density, lastStair, originalBeatmap); recordNote(original.StartTime, positionData.Position); } From e51f96e181d1996d1da4ac4ce62e0e126e8c68e0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 20:52:36 +0900 Subject: [PATCH 031/304] Fix some notes not being recorded --- .../Beatmaps/ManiaBeatmapConverter.cs | 12 +++++ .../Legacy/DistanceObjectPatternGenerator.cs | 47 ++++++++++--------- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index d76ae4f081..bc2c9943db 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -136,6 +136,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps var endTimeData = original as IHasEndTime; var distanceData = original as IHasDistance; var positionData = original as IHasPosition; + var repeatsData = original as IHasRepeats; Patterns.PatternGenerator conversion = null; @@ -143,9 +144,20 @@ namespace osu.Game.Rulesets.Mania.Beatmaps { var generator = new DistanceObjectPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap); conversion = generator; + + for (double time = original.StartTime; time <= generator.EndTime; time += generator.SegmentDuration) + { + recordNote(time, positionData?.Position ?? Vector2.Zero); + computeDensity(time); + } } else if (endTimeData != null) + { conversion = new EndTimeObjectPatternGenerator(Random, original, beatmap, originalBeatmap); + + recordNote(endTimeData.EndTime, new Vector2(256, 192)); + computeDensity(endTimeData.EndTime); + } else if (positionData != null) { computeDensity(original.StartTime); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index f60958d581..a4275be504 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -24,8 +24,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy /// private const float osu_base_scoring_distance = 100; - private readonly double endTime; - private readonly double segmentDuration; + public readonly double EndTime; + public readonly double SegmentDuration; + private readonly int spanCount; private PatternType convertType; @@ -52,8 +53,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy // The duration of the osu! hit object double osuDuration = distance / osuVelocity; - endTime = hitObject.StartTime + osuDuration; - segmentDuration = (endTime - HitObject.StartTime) / spanCount; + EndTime = hitObject.StartTime + osuDuration; + SegmentDuration = (EndTime - HitObject.StartTime) / spanCount; } public override Pattern Generate() @@ -61,44 +62,44 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (TotalColumns == 1) { var pattern = new Pattern(); - addToPattern(pattern, 0, HitObject.StartTime, endTime); + addToPattern(pattern, 0, HitObject.StartTime, EndTime); return pattern; } if (spanCount > 1) { - if (segmentDuration <= 90) + if (SegmentDuration <= 90) return generateRandomHoldNotes(HitObject.StartTime, 1); - if (segmentDuration <= 120) + if (SegmentDuration <= 120) { convertType |= PatternType.ForceNotStack; return generateRandomNotes(HitObject.StartTime, spanCount + 1); } - if (segmentDuration <= 160) + if (SegmentDuration <= 160) return generateStair(HitObject.StartTime); - if (segmentDuration <= 200 && ConversionDifficulty > 3) + if (SegmentDuration <= 200 && ConversionDifficulty > 3) return generateRandomMultipleNotes(HitObject.StartTime); - double duration = endTime - HitObject.StartTime; + double duration = EndTime - HitObject.StartTime; if (duration >= 4000) return generateNRandomNotes(HitObject.StartTime, 0.23, 0, 0); - if (segmentDuration > 400 && spanCount < TotalColumns - 1 - RandomStart) + if (SegmentDuration > 400 && spanCount < TotalColumns - 1 - RandomStart) return generateTiledHoldNotes(HitObject.StartTime); return generateHoldAndNormalNotes(HitObject.StartTime); } - if (segmentDuration <= 110) + if (SegmentDuration <= 110) { if (PreviousPattern.ColumnWithObjects < TotalColumns) convertType |= PatternType.ForceNotStack; else convertType &= ~PatternType.ForceNotStack; - return generateRandomNotes(HitObject.StartTime, segmentDuration < 80 ? 1 : 2); + return generateRandomNotes(HitObject.StartTime, SegmentDuration < 80 ? 1 : 2); } if (ConversionDifficulty > 6.5) @@ -148,7 +149,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { while (pattern.ColumnHasObject(nextColumn) || PreviousPattern.ColumnHasObject(nextColumn)) //find available column nextColumn = Random.Next(RandomStart, TotalColumns); - addToPattern(pattern, nextColumn, startTime, endTime); + addToPattern(pattern, nextColumn, startTime, EndTime); } // This is can't be combined with the above loop due to RNG @@ -156,7 +157,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { while (pattern.ColumnHasObject(nextColumn)) nextColumn = Random.Next(RandomStart, TotalColumns); - addToPattern(pattern, nextColumn, startTime, endTime); + addToPattern(pattern, nextColumn, startTime, EndTime); } return pattern; @@ -193,7 +194,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy nextColumn = Random.Next(RandomStart, TotalColumns); lastColumn = nextColumn; - startTime += segmentDuration; + startTime += SegmentDuration; } return pattern; @@ -223,7 +224,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy for (int i = 0; i <= spanCount; i++) { addToPattern(pattern, column, startTime, startTime); - startTime += segmentDuration; + startTime += SegmentDuration; // Check if we're at the borders of the stage, and invert the pattern if so if (increasing) @@ -284,7 +285,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy addToPattern(pattern, nextColumn, startTime, startTime); nextColumn = Random.Next(RandomStart, TotalColumns); - startTime += segmentDuration; + startTime += SegmentDuration; } return pattern; @@ -372,8 +373,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy while (pattern.ColumnHasObject(nextColumn)) nextColumn = Random.Next(RandomStart, TotalColumns); - addToPattern(pattern, nextColumn, startTime, endTime); - startTime += segmentDuration; + addToPattern(pattern, nextColumn, startTime, EndTime); + startTime += SegmentDuration; } return pattern; @@ -402,7 +403,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy } // Create the hold note - addToPattern(pattern, holdColumn, startTime, endTime); + addToPattern(pattern, holdColumn, startTime, EndTime); int nextColumn = Random.Next(RandomStart, TotalColumns); int noteCount; @@ -434,7 +435,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy pattern.Add(rowPattern); rowPattern.Clear(); - startTime += segmentDuration; + startTime += SegmentDuration; } return pattern; @@ -452,7 +453,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (curveData == null) return HitObject.Samples; - double segmentTime = (endTime - HitObject.StartTime) / spanCount; + double segmentTime = (EndTime - HitObject.StartTime) / spanCount; int index = (int)(segmentTime == 0 ? 0 : (time - HitObject.StartTime) / segmentTime); return curveData.RepeatSamples[index]; From 5f5d797c1effc6ae2f9c96811ab6e5272ebdf347 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 21:06:35 +0900 Subject: [PATCH 032/304] Remove unused field --- osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index bc2c9943db..0f99f999da 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -136,7 +136,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps var endTimeData = original as IHasEndTime; var distanceData = original as IHasDistance; var positionData = original as IHasPosition; - var repeatsData = original as IHasRepeats; Patterns.PatternGenerator conversion = null; From 53a6d01304a3540f8a9f3684e471f683ad4c14a3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 21:06:54 +0900 Subject: [PATCH 033/304] Fix stair type not being flipped correctly --- .../Legacy/HitObjectPatternGenerator.cs | 199 +++++++++--------- 1 file changed, 100 insertions(+), 99 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index 1ea2863520..2210c76788 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -89,120 +89,121 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy public override Pattern Generate() { - if (TotalColumns == 1) + var pattern = new Pattern(); + + try { - var pattern = new Pattern(); - addToPattern(pattern, 0); - return pattern; - } - - int lastColumn = PreviousPattern.HitObjects.FirstOrDefault()?.Column ?? 0; - - if ((convertType & PatternType.Reverse) > 0 && PreviousPattern.HitObjects.Any()) - { - // Generate a new pattern by copying the last hit objects in reverse-column order - var pattern = new Pattern(); - - for (int i = RandomStart; i < TotalColumns; i++) - if (PreviousPattern.ColumnHasObject(i)) - addToPattern(pattern, RandomStart + TotalColumns - i - 1); - - return pattern; - } - - if ((convertType & PatternType.Cycle) > 0 && PreviousPattern.HitObjects.Count() == 1 - // If we convert to 7K + 1, let's not overload the special key - && (TotalColumns != 8 || lastColumn != 0) - // Make sure the last column was not the centre column - && (TotalColumns % 2 == 0 || lastColumn != TotalColumns / 2)) - { - // Generate a new pattern by cycling backwards (similar to Reverse but for only one hit object) - var pattern = new Pattern(); - - int column = RandomStart + TotalColumns - lastColumn - 1; - addToPattern(pattern, column); - - return pattern; - } - - if ((convertType & PatternType.ForceStack) > 0 && PreviousPattern.HitObjects.Any()) - { - // Generate a new pattern by placing on the already filled columns - var pattern = new Pattern(); - - for (int i = RandomStart; i < TotalColumns; i++) - if (PreviousPattern.ColumnHasObject(i)) - addToPattern(pattern, i); - - return pattern; - } - - if ((convertType & PatternType.Stair) > 0 && PreviousPattern.HitObjects.Count() == 1) - { - // Generate a new pattern by placing on the next column, cycling back to the start if there is no "next" - var pattern = new Pattern(); - - int targetColumn = lastColumn + 1; - if (targetColumn == TotalColumns) + if (TotalColumns == 1) { - targetColumn = RandomStart; - StairType = PatternType.ReverseStair; + addToPattern(pattern, 0); + return pattern; } - addToPattern(pattern, targetColumn); - return pattern; - } + int lastColumn = PreviousPattern.HitObjects.FirstOrDefault()?.Column ?? 0; - if ((convertType & PatternType.ReverseStair) > 0 && PreviousPattern.HitObjects.Count() == 1) - { - // Generate a new pattern by placing on the previous column, cycling back to the end if there is no "previous" - var pattern = new Pattern(); - - int targetColumn = lastColumn - 1; - if (targetColumn == RandomStart - 1) + if ((convertType & PatternType.Reverse) > 0 && PreviousPattern.HitObjects.Any()) { - targetColumn = TotalColumns - 1; - StairType = PatternType.Stair; + // Generate a new pattern by copying the last hit objects in reverse-column order + for (int i = RandomStart; i < TotalColumns; i++) + if (PreviousPattern.ColumnHasObject(i)) + addToPattern(pattern, RandomStart + TotalColumns - i - 1); + + return pattern; } - addToPattern(pattern, targetColumn); - return pattern; - } + if ((convertType & PatternType.Cycle) > 0 && PreviousPattern.HitObjects.Count() == 1 + // If we convert to 7K + 1, let's not overload the special key + && (TotalColumns != 8 || lastColumn != 0) + // Make sure the last column was not the centre column + && (TotalColumns % 2 == 0 || lastColumn != TotalColumns / 2)) + { + // Generate a new pattern by cycling backwards (similar to Reverse but for only one hit object) + int column = RandomStart + TotalColumns - lastColumn - 1; + addToPattern(pattern, column); - if ((convertType & PatternType.KeepSingle) > 0) - return generateRandomNotes(1); + return pattern; + } + + if ((convertType & PatternType.ForceStack) > 0 && PreviousPattern.HitObjects.Any()) + { + // Generate a new pattern by placing on the already filled columns + for (int i = RandomStart; i < TotalColumns; i++) + if (PreviousPattern.ColumnHasObject(i)) + addToPattern(pattern, i); + + return pattern; + } + + if (PreviousPattern.HitObjects.Count() == 1) + { + if ((convertType & PatternType.Stair) > 0) + { + // Generate a new pattern by placing on the next column, cycling back to the start if there is no "next" + int targetColumn = lastColumn + 1; + if (targetColumn == TotalColumns) + targetColumn = RandomStart; + + addToPattern(pattern, targetColumn); + return pattern; + } + + if ((convertType & PatternType.ReverseStair) > 0) + { + // Generate a new pattern by placing on the previous column, cycling back to the end if there is no "previous" + int targetColumn = lastColumn - 1; + if (targetColumn == RandomStart - 1) + targetColumn = TotalColumns - 1; + + addToPattern(pattern, targetColumn); + return pattern; + } + } + + if ((convertType & PatternType.KeepSingle) > 0) + return pattern = generateRandomNotes(1); + + if ((convertType & PatternType.Mirror) > 0) + { + if (ConversionDifficulty > 6.5) + return pattern = generateRandomPatternWithMirrored(0.12, 0.38, 0.12); + if (ConversionDifficulty > 4) + return pattern = generateRandomPatternWithMirrored(0.12, 0.17, 0); + return pattern = generateRandomPatternWithMirrored(0.12, 0, 0); + } - if ((convertType & PatternType.Mirror) > 0) - { if (ConversionDifficulty > 6.5) - return generateRandomPatternWithMirrored(0.12, 0.38, 0.12); + { + if ((convertType & PatternType.LowProbability) > 0) + return pattern = generateRandomPattern(0.78, 0.42, 0, 0); + return pattern = generateRandomPattern(1, 0.62, 0, 0); + } + if (ConversionDifficulty > 4) - return generateRandomPatternWithMirrored(0.12, 0.17, 0); - return generateRandomPatternWithMirrored(0.12, 0, 0); - } + { + if ((convertType & PatternType.LowProbability) > 0) + return pattern = generateRandomPattern(0.35, 0.08, 0, 0); + return pattern = generateRandomPattern(0.52, 0.15, 0, 0); + } - if (ConversionDifficulty > 6.5) + if (ConversionDifficulty > 2) + { + if ((convertType & PatternType.LowProbability) > 0) + return pattern = generateRandomPattern(0.18, 0, 0, 0); + return pattern = generateRandomPattern(0.45, 0, 0, 0); + } + + return pattern = generateRandomPattern(0, 0, 0, 0); + } + finally { - if ((convertType & PatternType.LowProbability) > 0) - return generateRandomPattern(0.78, 0.42, 0, 0); - return generateRandomPattern(1, 0.62, 0, 0); + foreach (var obj in pattern.HitObjects) + { + if ((convertType & PatternType.Stair) > 0 && obj.Column == TotalColumns - 1) + StairType = PatternType.ReverseStair; + if ((convertType & PatternType.ReverseStair) > 0 && obj.Column == RandomStart) + StairType = PatternType.Stair; + } } - - if (ConversionDifficulty > 4) - { - if ((convertType & PatternType.LowProbability) > 0) - return generateRandomPattern(0.35, 0.08, 0, 0); - return generateRandomPattern(0.52, 0.15, 0, 0); - } - - if (ConversionDifficulty > 2) - { - if ((convertType & PatternType.LowProbability) > 0) - return generateRandomPattern(0.18, 0, 0, 0); - return generateRandomPattern(0.45, 0, 0, 0); - } - - return generateRandomPattern(0, 0, 0, 0); } /// From 2d59ae9354249a2e39930db38f1a74e24175bcbb Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 22:08:24 +0900 Subject: [PATCH 034/304] Commit forgotten variable --- osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 0f99f999da..536b1a8552 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -102,7 +102,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps private double lastTime; private Vector2 lastPosition; - private PatternType lastStair; + private PatternType lastStair = PatternType.Stair; private void recordNote(double time, Vector2 position) { lastTime = time; From 55f0b3c42cc895ca859a3864c60714d973271647 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 22:10:57 +0900 Subject: [PATCH 035/304] Distance object generator should output a secondary pattern In osu!stable, only the hitobjects which ended at the distance object's EndTime would be considered for further pattern generation. Previously this generator was group _all_ objects including those that don't end at the object's EndTime, resulting in incorrect hitobject count for further pattern generation. --- .../Beatmaps/ManiaBeatmapConverter.cs | 29 +++++++++++++------ .../Legacy/DistanceObjectPatternGenerator.cs | 26 ++++++++++++++++- .../Legacy/EndTimeObjectPatternGenerator.cs | 7 ++++- .../Legacy/HitObjectPatternGenerator.cs | 8 ++++- .../Beatmaps/Patterns/PatternGenerator.cs | 7 +++-- 5 files changed, 62 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 536b1a8552..2c4c7b0f18 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -119,10 +119,13 @@ namespace osu.Game.Rulesets.Mania.Beatmaps { var generator = new SpecificBeatmapPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap); - Pattern newPattern = generator.Generate(); - lastPattern = newPattern; + foreach (var newPattern in generator.Generate()) + { + lastPattern = newPattern; - return newPattern.HitObjects; + foreach (var obj in newPattern.HitObjects) + yield return obj; + } } /// @@ -167,14 +170,17 @@ namespace osu.Game.Rulesets.Mania.Beatmaps } if (conversion == null) - return null; + yield break; - Pattern newPattern = conversion.Generate(); + foreach (var newPattern in conversion.Generate()) + { + lastPattern = conversion is EndTimeObjectPatternGenerator ? lastPattern : newPattern; + lastStair = (conversion as HitObjectPatternGenerator)?.StairType ?? lastStair; - lastPattern = conversion is EndTimeObjectPatternGenerator ? lastPattern : newPattern; - lastStair = (conversion as HitObjectPatternGenerator)?.StairType ?? lastStair; + foreach (var obj in newPattern.HitObjects) + yield return obj; - return newPattern.HitObjects; + } } /// @@ -187,7 +193,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps { } - public override Pattern Generate() + public override IEnumerable Generate() + { + yield return generate(); + } + + private Pattern generate() { var endTimeData = HitObject as IHasEndTime; var positionData = HitObject as IHasXPosition; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index a4275be504..e33af44df2 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using osu.Framework.MathUtils; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.MathUtils; @@ -57,7 +58,30 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy SegmentDuration = (EndTime - HitObject.StartTime) / spanCount; } - public override Pattern Generate() + public override IEnumerable Generate() + { + var originalPattern = generate(); + + // We need to split the intermediate pattern into two new patterns: + // 1. A pattern containing all objects that do not end at our EndTime. + // 2. A pattern containing all objects that end at our EndTime. This will be used for further pattern generation. + var intermediatePattern = new Pattern(); + var endTimePattern = new Pattern(); + + foreach (var obj in originalPattern.HitObjects) + { + if (!Precision.AlmostEquals(EndTime, (obj as IHasEndTime)?.EndTime ?? obj.StartTime)) + intermediatePattern.Add(obj); + else + endTimePattern.Add(obj); + } + + + yield return intermediatePattern; + yield return endTimePattern; + } + + private Pattern generate() { if (TotalColumns == 1) { diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs index 3f34afee85..0f170e8540 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs @@ -24,7 +24,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy endTime = endtimeData?.EndTime ?? 0; } - public override Pattern Generate() + public override IEnumerable Generate() + { + yield return generate(); + } + + private Pattern generate() { var pattern = new Pattern(); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index 2210c76788..0e839d87a2 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using System.Linq; using OpenTK; using osu.Game.Audio; @@ -87,7 +88,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy } } - public override Pattern Generate() + public override IEnumerable Generate() + { + yield return generate(); + } + + private Pattern generate() { var pattern = new Pattern(); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs index 2bfcd52b6a..a42d57cdd1 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns @@ -42,9 +43,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns } /// - /// Generates the pattern for , filled with hit objects. + /// Generates the patterns for , each filled with hit objects. /// - /// The containing the hit objects. - public abstract Pattern Generate(); + /// The s containing the hit objects. + public abstract IEnumerable Generate(); } } From 8529cece4a65bc006d4946fabee4cab9e98c48c5 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Jun 2018 20:17:19 +0900 Subject: [PATCH 036/304] Fix precision error --- osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 2c4c7b0f18..e21738f8c8 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -147,7 +147,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps var generator = new DistanceObjectPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap); conversion = generator; - for (double time = original.StartTime; time <= generator.EndTime; time += generator.SegmentDuration) + for (double time = original.StartTime; !Precision.DefinitelyBigger(time, generator.EndTime); time += generator.SegmentDuration) { recordNote(time, positionData?.Position ?? Vector2.Zero); computeDensity(time); From 0625bfda301f8dfea9531d9c14c765bf9c66a855 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Jun 2018 20:17:49 +0900 Subject: [PATCH 037/304] Don't split single hitobject into multiple patterns --- .../Patterns/Legacy/DistanceObjectPatternGenerator.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index e33af44df2..e96ba19c80 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -62,6 +62,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { var originalPattern = generate(); + if (originalPattern.HitObjects.Count() == 1) + { + yield return originalPattern; + yield break; + } + // We need to split the intermediate pattern into two new patterns: // 1. A pattern containing all objects that do not end at our EndTime. // 2. A pattern containing all objects that end at our EndTime. This will be used for further pattern generation. @@ -76,7 +82,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy endTimePattern.Add(obj); } - yield return intermediatePattern; yield return endTimePattern; } From f090e82b638a2dc0a6f82f76e803d79039028e43 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Jun 2018 21:06:09 +0900 Subject: [PATCH 038/304] Fix inverted conditional --- .../Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index e96ba19c80..280c2f45d4 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -359,7 +359,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy break; } - bool isDoubleSample(SampleInfo sample) => sample.Name == SampleInfo.HIT_CLAP && sample.Name == SampleInfo.HIT_FINISH; + bool isDoubleSample(SampleInfo sample) => sample.Name == SampleInfo.HIT_CLAP || sample.Name == SampleInfo.HIT_FINISH; bool canGenerateTwoNotes = (convertType & PatternType.LowProbability) == 0; canGenerateTwoNotes &= HitObject.Samples.Any(isDoubleSample) || sampleInfoListAt(HitObject.StartTime).Any(isDoubleSample); From a623155b9fbe87236acbafbcc0d302ac30cfde63 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Jun 2018 13:51:53 +0900 Subject: [PATCH 039/304] Fix missing using --- osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index e21738f8c8..c15b303048 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -5,6 +5,7 @@ using osu.Game.Rulesets.Mania.Objects; using System; using System.Linq; using System.Collections.Generic; +using osu.Framework.MathUtils; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; From 6cd9a22e265ad31688eadc4d41247a1b851c2a19 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Jun 2018 13:52:14 +0900 Subject: [PATCH 040/304] Update testcase --- .../ManiaBeatmapConversionTest.cs | 1 - .../Beatmaps/basic-expected-conversion.json | 229 ++++++++++-------- 2 files changed, 129 insertions(+), 101 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs index c13319ace9..33ac1e00e4 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs @@ -18,7 +18,6 @@ namespace osu.Game.Rulesets.Mania.Tests { protected override string ResourceAssembly => "osu.Game.Rulesets.Mania"; - [NonParallelizable] [TestCase("basic")] public new void Test(string name) { diff --git a/osu.Game.Rulesets.Mania/Resources/Testing/Beatmaps/basic-expected-conversion.json b/osu.Game.Rulesets.Mania/Resources/Testing/Beatmaps/basic-expected-conversion.json index d593b2b052..753db99856 100644 --- a/osu.Game.Rulesets.Mania/Resources/Testing/Beatmaps/basic-expected-conversion.json +++ b/osu.Game.Rulesets.Mania/Resources/Testing/Beatmaps/basic-expected-conversion.json @@ -1,103 +1,132 @@ { "Mappings": [{ - "StartTime": 500, - "Objects": [{ - "StartTime": 500, - "EndTime": 2500, - "Column": 0 - }, - { - "StartTime": 1500, - "EndTime": 2500, - "Column": 1 - } - ] - }, - { - "StartTime": 3000, - "Objects": [{ - "StartTime": 3000, - "EndTime": 4000, - "Column": 2 - }] - }, - { - "StartTime": 4500, - "Objects": [{ - "StartTime": 4500, - "EndTime": 5500, - "Column": 4 - }] - }, - { - "StartTime": 6000, - "Objects": [{ - "StartTime": 6000, - "EndTime": 6500, - "Column": 2 - }] - }, - { - "StartTime": 7000, - "Objects": [{ - "StartTime": 7000, - "EndTime": 8000, - "Column": 2 - }] - }, - { - "StartTime": 8500, - "Objects": [{ - "StartTime": 8500, - "EndTime": 11000, - "Column": 0 - }] - }, - { - "StartTime": 11500, - "Objects": [{ - "StartTime": 11500, - "EndTime": 12000, - "Column": 1 - }] - }, - { - "StartTime": 12500, - "Objects": [{ - "StartTime": 12500, - "EndTime": 16500, - "Column": 4 - }] - }, - { - "StartTime": 17000, - "Objects": [{ - "StartTime": 17000, - "EndTime": 18000, - "Column": 2 - }] - }, - { - "StartTime": 18500, - "Objects": [{ - "StartTime": 18500, - "EndTime": 19450, - "Column": 0 - }] - }, - { - "StartTime": 19875, - "Objects": [{ - "StartTime": 19875, - "EndTime": 23875, - "Column": 1 - }, - { - "StartTime": 19875, - "EndTime": 23875, - "Column": 0 - } - ] - } - ] + "RandomW": 2659373485, + "RandomX": 3579807591, + "RandomY": 273326509, + "RandomZ": 272969173, + "StartTime": 500.0, + "Objects": [{ + "StartTime": 500.0, + "EndTime": 2500.0, + "Column": 0 + }, { + "StartTime": 1500.0, + "EndTime": 2500.0, + "Column": 1 + }] + }, { + "RandomW": 3083803045, + "RandomX": 273326509, + "RandomY": 272969173, + "RandomZ": 2659373485, + "StartTime": 3000.0, + "Objects": [{ + "StartTime": 3000.0, + "EndTime": 4000.0, + "Column": 2 + }] + }, { + "RandomW": 4073554232, + "RandomX": 272969173, + "RandomY": 2659373485, + "RandomZ": 3083803045, + "StartTime": 4500.0, + "Objects": [{ + "StartTime": 4500.0, + "EndTime": 5500.0, + "Column": 4 + }] + }, { + "RandomW": 3420401969, + "RandomX": 2659373485, + "RandomY": 3083803045, + "RandomZ": 4073554232, + "StartTime": 6000.0, + "Objects": [{ + "StartTime": 6000.0, + "EndTime": 6500.0, + "Column": 2 + }] + }, { + "RandomW": 1129881182, + "RandomX": 3083803045, + "RandomY": 4073554232, + "RandomZ": 3420401969, + "StartTime": 7000.0, + "Objects": [{ + "StartTime": 7000.0, + "EndTime": 8000.0, + "Column": 2 + }] + }, { + "RandomW": 315568458, + "RandomX": 3420401969, + "RandomY": 1129881182, + "RandomZ": 2358617505, + "StartTime": 8500.0, + "Objects": [{ + "StartTime": 8500.0, + "EndTime": 11000.0, + "Column": 0 + }] + }, { + "RandomW": 548134043, + "RandomX": 1129881182, + "RandomY": 2358617505, + "RandomZ": 315568458, + "StartTime": 11500.0, + "Objects": [{ + "StartTime": 11500.0, + "EndTime": 12000.0, + "Column": 1 + }] + }, { + "RandomW": 3979422122, + "RandomX": 548134043, + "RandomY": 2810584254, + "RandomZ": 2250186050, + "StartTime": 12500.0, + "Objects": [{ + "StartTime": 12500.0, + "EndTime": 16500.0, + "Column": 4 + }] + }, { + "RandomW": 2466283411, + "RandomX": 2810584254, + "RandomY": 2250186050, + "RandomZ": 3979422122, + "StartTime": 17000.0, + "Objects": [{ + "StartTime": 17000.0, + "EndTime": 18000.0, + "Column": 2 + }] + }, { + "RandomW": 83157665, + "RandomX": 2250186050, + "RandomY": 3979422122, + "RandomZ": 2466283411, + "StartTime": 18500.0, + "Objects": [{ + "StartTime": 18500.0, + "EndTime": 19450.0, + "Column": 0 + }] + }, { + "RandomW": 2383087700, + "RandomX": 83157665, + "RandomY": 2055150192, + "RandomZ": 510071020, + "StartTime": 19875.0, + "Objects": [{ + "StartTime": 19875.0, + "EndTime": 23875.0, + "Column": 1 + }, { + "StartTime": 19875.0, + "EndTime": 23875.0, + "Column": 0 + }] + }] } \ No newline at end of file From d879b96d9f70869d001b4dfc62481eab93591390 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 28 Jun 2018 13:43:56 +0900 Subject: [PATCH 041/304] Implement storyboard samples --- .../Drawables/DrawableStoryboardSample.cs | 68 +++++++++++++++++++ osu.Game/Storyboards/StoryboardSample.cs | 9 +-- 2 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs new file mode 100644 index 0000000000..9a539072d0 --- /dev/null +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs @@ -0,0 +1,68 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.IO; +using osu.Framework.Allocation; +using osu.Framework.Audio.Sample; +using osu.Framework.Graphics; +using osu.Game.Beatmaps; + +namespace osu.Game.Storyboards.Drawables +{ + public class DrawableStoryboardSample : Component + { + /// + /// The amount of time allowable beyond the start time of the sample, for the sample to start. + /// + private const double allowable_late_start = 100; + + private readonly StoryboardSample sample; + private SampleChannel channel; + + public override bool RemoveWhenNotAlive => false; + + public DrawableStoryboardSample(StoryboardSample sample) + { + this.sample = sample; + LifetimeStart = sample.Time; + } + + [BackgroundDependencyLoader] + private void load(IBindableBeatmap beatmap) + { + // Try first with the full name, then attempt with no path + channel = beatmap.Value.Skin.GetSample(sample.Path) ?? beatmap.Value.Skin.GetSample(Path.ChangeExtension(sample.Path, null)); + + if (channel != null) + channel.Volume.Value = sample.Volume / 100; + } + + protected override void Update() + { + base.Update(); + + if (Time.Current < sample.Time) + { + // We've rewound before the start time of the sample + channel?.Stop(); + + // In the case that the user fast-forwards to a point far beyond the start time of the sample, + // we want to be able to fall into the if-conditional below (therefore we must not have a life time end) + LifetimeStart = sample.Time; + LifetimeEnd = double.MaxValue; + } + else if (Time.Current - Time.Elapsed < sample.Time) + { + // We've passed the start time of the sample. We only play the sample if we're within an allowable range + // from the sample's start, to reduce layering if we've been fast-forwarded far into the future + if (Time.Current - sample.Time < allowable_late_start) + channel?.Play(); + + // In the case that the user rewinds to a point far behind the start time of the sample, + // we want to be able to fall into the if-conditional above (therefore we must not have a life time start) + LifetimeStart = double.MinValue; + LifetimeEnd = sample.Time; + } + } + } +} diff --git a/osu.Game/Storyboards/StoryboardSample.cs b/osu.Game/Storyboards/StoryboardSample.cs index d0555493a6..c34a39a7bf 100644 --- a/osu.Game/Storyboards/StoryboardSample.cs +++ b/osu.Game/Storyboards/StoryboardSample.cs @@ -2,14 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using System; +using osu.Game.Storyboards.Drawables; namespace osu.Game.Storyboards { public class StoryboardSample : IStoryboardElement { public string Path { get; set; } - public bool IsDrawable => false; + public bool IsDrawable => true; public double Time; public float Volume; @@ -21,9 +21,6 @@ namespace osu.Game.Storyboards Volume = volume; } - public Drawable CreateDrawable() - { - throw new InvalidOperationException(); - } + public Drawable CreateDrawable() => new DrawableStoryboardSample(this); } } From 2aae528e1ccf08e0feb586a83faf02c3205de8d3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 3 Jul 2018 18:18:04 +0900 Subject: [PATCH 042/304] Improve code quality of main menu button system --- osu.Game.Tests/Visual/TestCaseButtonSystem.cs | 13 ++ osu.Game/Screens/Menu/Button.cs | 36 ++- osu.Game/Screens/Menu/ButtonArea.cs | 148 ++++++++++++ osu.Game/Screens/Menu/ButtonSystem.cs | 217 +++++------------- osu.Game/Screens/Menu/MainMenu.cs | 10 +- 5 files changed, 263 insertions(+), 161 deletions(-) create mode 100644 osu.Game/Screens/Menu/ButtonArea.cs diff --git a/osu.Game.Tests/Visual/TestCaseButtonSystem.cs b/osu.Game.Tests/Visual/TestCaseButtonSystem.cs index 5eb81cdf9f..7f8133d638 100644 --- a/osu.Game.Tests/Visual/TestCaseButtonSystem.cs +++ b/osu.Game.Tests/Visual/TestCaseButtonSystem.cs @@ -1,6 +1,9 @@ // 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 NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -13,6 +16,13 @@ namespace osu.Game.Tests.Visual [TestFixture] public class TestCaseButtonSystem : OsuTestCase { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(ButtonSystem), + typeof(ButtonArea), + typeof(Button) + }; + public TestCaseButtonSystem() { OsuLogo logo; @@ -30,6 +40,9 @@ namespace osu.Game.Tests.Visual }; buttons.SetOsuLogo(logo); + + foreach (var s in Enum.GetValues(typeof(ButtonSystemState)).OfType().Skip(1)) + AddStep($"State to {s}", () => buttons.State = s); } } } diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 542ddd2c92..f862905b5e 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -35,6 +35,12 @@ namespace osu.Game.Screens.Menu private readonly Box boxHoverLayer; private readonly SpriteIcon icon; private readonly string sampleName; + + /// + /// The menu state for which we are visible for. + /// + public ButtonSystemState? VisibleState; + private readonly Action clickAction; private readonly Key triggerKey; private SampleChannel sampleClick; @@ -51,7 +57,7 @@ namespace osu.Game.Screens.Menu AutoSizeAxes = Axes.Both; Alpha = 0; - Vector2 boxSize = new Vector2(ButtonSystem.BUTTON_WIDTH + Math.Abs(extraWidth), ButtonSystem.BUTTON_AREA_HEIGHT); + Vector2 boxSize = new Vector2(ButtonSystem.BUTTON_WIDTH + Math.Abs(extraWidth), ButtonArea.BUTTON_AREA_HEIGHT); Children = new Drawable[] { @@ -260,6 +266,7 @@ namespace osu.Game.Screens.Menu this.FadeOut(800); break; } + break; case ButtonState.Expanded: const int expand_duration = 500; @@ -276,6 +283,33 @@ namespace osu.Game.Screens.Menu StateChanged?.Invoke(State); } } + + public ButtonSystemState ButtonSystemState + { + set + { + ContractStyle = 0; + + switch (value) + { + case ButtonSystemState.Initial: + State = ButtonState.Contracted; + break; + case ButtonSystemState.EnteringMode: + ContractStyle = 1; + State = ButtonState.Contracted; + break; + default: + if (!VisibleState.HasValue || value == VisibleState) + State = ButtonState.Expanded; + else if (value < VisibleState) + State = ButtonState.Contracted; + else + State = ButtonState.Exploded; + break; + } + } + } } public enum ButtonState diff --git a/osu.Game/Screens/Menu/ButtonArea.cs b/osu.Game/Screens/Menu/ButtonArea.cs new file mode 100644 index 0000000000..06004405b6 --- /dev/null +++ b/osu.Game/Screens/Menu/ButtonArea.cs @@ -0,0 +1,148 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using OpenTK; + +namespace osu.Game.Screens.Menu +{ + public class ButtonArea : Container, IStateful + { + public FlowContainerWithOrigin Flow; + + protected override Container Content => Flow; + + private readonly ButtonAreaBackground buttonAreaBackground; + private Visibility state; + + public const float BUTTON_AREA_HEIGHT = 100; + + public ButtonArea() + { + RelativeSizeAxes = Axes.Both; + InternalChild = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + Size = new Vector2(1, BUTTON_AREA_HEIGHT), + Alpha = 0, + Children = new Drawable[] + { + buttonAreaBackground = new ButtonAreaBackground(), + Flow = new FlowContainerWithOrigin + { + Direction = FillDirection.Horizontal, + Spacing = new Vector2(-ButtonSystem.WEDGE_WIDTH, 0), + Anchor = Anchor.Centre, + AutoSizeAxes = Axes.Both, + } + } + }; + } + + public ButtonSystemState ButtonSystemState + { + set + { + switch (value) + { + case ButtonSystemState.Exit: + case ButtonSystemState.Initial: + case ButtonSystemState.EnteringMode: + State = Visibility.Hidden; + break; + case ButtonSystemState.TopLevel: + case ButtonSystemState.Play: + State = Visibility.Visible; + break; + } + + buttonAreaBackground.ButtonSystemState = value; + } + } + + public Visibility State + { + get => state; + set + { + if (value == state) return; + + state = value; + InternalChild.FadeTo(state == Visibility.Hidden ? 0 : 1, 300); + StateChanged?.Invoke(state); + } + } + + public event Action StateChanged; + + private class ButtonAreaBackground : Box, IStateful + { + private ButtonAreaBackgroundState state; + + public ButtonAreaBackground() + { + RelativeSizeAxes = Axes.Both; + Size = new Vector2(2, 1); + Colour = OsuColour.Gray(50); + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + } + + public ButtonAreaBackgroundState State + { + get => state; + set + { + if (value == state) return; + + state = value; + + switch (state) + { + case ButtonAreaBackgroundState.Flat: + this.ScaleTo(new Vector2(2, 0), 300, Easing.InSine); + break; + case ButtonAreaBackgroundState.Normal: + this.ScaleTo(Vector2.One, 400, Easing.OutQuint); + break; + } + + StateChanged?.Invoke(state); + } + } + + public ButtonSystemState ButtonSystemState + { + set + { + switch (value) + { + default: + State = ButtonAreaBackgroundState.Normal; + break; + case ButtonSystemState.Initial: + case ButtonSystemState.Exit: + case ButtonSystemState.EnteringMode: + State = ButtonAreaBackgroundState.Flat; + break; + } + } + } + + public event Action StateChanged; + } + + public enum ButtonAreaBackgroundState + { + Normal, + Flat + } + } +} diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 374877673f..4f2437cf01 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -10,9 +10,9 @@ using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Framework.Input.Bindings; +using osu.Framework.Logging; using osu.Framework.Threading; using osu.Game.Graphics; using osu.Game.Input.Bindings; @@ -23,9 +23,9 @@ using OpenTK.Input; namespace osu.Game.Screens.Menu { - public class ButtonSystem : Container, IStateful, IKeyBindingHandler + public class ButtonSystem : Container, IStateful, IKeyBindingHandler { - public event Action StateChanged; + public event Action StateChanged; public Action OnEdit; public Action OnExit; @@ -34,12 +34,6 @@ namespace osu.Game.Screens.Menu public Action OnSettings; public Action OnMulti; public Action OnChart; - public Action OnTest; - - private readonly FlowContainerWithOrigin buttonFlow; - - //todo: make these non-internal somehow. - public const float BUTTON_AREA_HEIGHT = 100; public const float BUTTON_WIDTH = 140f; public const float WEDGE_WIDTH = 20; @@ -55,18 +49,16 @@ namespace osu.Game.Screens.Menu this.logo.Action = onOsuLogo; // osuLogo.SizeForFlow relies on loading to be complete. - buttonFlow.Position = new Vector2(WEDGE_WIDTH * 2 - (BUTTON_WIDTH + this.logo.SizeForFlow / 4), 0); + buttonArea.Flow.Position = new Vector2(WEDGE_WIDTH * 2 - (BUTTON_WIDTH + this.logo.SizeForFlow / 4), 0); updateLogoState(); } } private readonly Drawable iconFacade; - private readonly Container buttonArea; - private readonly Box buttonAreaBackground; + private readonly ButtonArea buttonArea; private readonly Button backButton; - private readonly Button settingsButton; private readonly List public event Action BeatmapDownloadBegan; + /// + /// Fired when a beatmap download is interrupted, due to user cancellation or other failures. + /// + public event Action BeatmapDownloadFailed; + /// /// A default representation of a WorkingBeatmap to use when no beatmap is available. /// @@ -175,6 +180,8 @@ namespace osu.Game.Beatmaps request.Failure += error => { + BeatmapDownloadFailed?.Invoke(request); + if (error is OperationCanceledException) return; downloadNotification.State = ProgressNotificationState.Cancelled; diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs index 6acb58e165..6f4d4c0d6f 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs @@ -5,6 +5,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Game.Online.API.Requests; namespace osu.Game.Beatmaps.Drawables { @@ -19,9 +20,9 @@ namespace osu.Game.Beatmaps.Drawables private BeatmapManager beatmaps; /// - /// Whether the associated beatmap set has been downloading (by this instance or any other instance). + /// Holds the current download state of the beatmap, whether is has already been downloaded, is in progress, or is not downloaded. /// - public readonly BindableBool Downloaded = new BindableBool(); + public readonly Bindable DownloadState = new Bindable(); public BeatmapSetDownloader(BeatmapSetInfo set, bool noVideo = false) { @@ -36,10 +37,16 @@ namespace osu.Game.Beatmaps.Drawables beatmaps.ItemAdded += setAdded; beatmaps.ItemRemoved += setRemoved; + beatmaps.BeatmapDownloadBegan += downloadBegan; + beatmaps.BeatmapDownloadFailed += downloadFailed; // initial value - if (set.OnlineBeatmapSetID != null) - Downloaded.Value = beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == set.OnlineBeatmapSetID && !s.DeletePending).Any(); + if (set.OnlineBeatmapSetID != null && beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == set.OnlineBeatmapSetID && !s.DeletePending).Any()) + DownloadState.Value = DownloadStatus.Downloaded; + else if (beatmaps.GetExistingDownload(set) != null) + DownloadState.Value = DownloadStatus.Downloading; + else + DownloadState.Value = DownloadStatus.NotDownloaded; } protected override void Dispose(bool isDisposing) @@ -50,6 +57,8 @@ namespace osu.Game.Beatmaps.Drawables { beatmaps.ItemAdded -= setAdded; beatmaps.ItemRemoved -= setRemoved; + beatmaps.BeatmapDownloadBegan -= downloadBegan; + beatmaps.BeatmapDownloadFailed -= downloadFailed; } } @@ -57,28 +66,45 @@ namespace osu.Game.Beatmaps.Drawables /// Begin downloading the associated beatmap set. /// /// True if downloading began. False if an existing download is active or completed. - public bool Download() + public void Download() { - if (Downloaded.Value) - return false; - - if (beatmaps.GetExistingDownload(set) != null) - return false; + if (DownloadState.Value > DownloadStatus.NotDownloaded) + return; beatmaps.Download(set, noVideo); - return true; + + DownloadState.Value = DownloadStatus.Downloading; } private void setAdded(BeatmapSetInfo s) { if (s.OnlineBeatmapSetID == set.OnlineBeatmapSetID) - Downloaded.Value = true; + DownloadState.Value = DownloadStatus.Downloaded; } private void setRemoved(BeatmapSetInfo s) { if (s.OnlineBeatmapSetID == set.OnlineBeatmapSetID) - Downloaded.Value = false; + DownloadState.Value = DownloadStatus.NotDownloaded; + } + + private void downloadBegan(DownloadBeatmapSetRequest d) + { + if (d.BeatmapSet.OnlineBeatmapSetID == set.OnlineBeatmapSetID) + DownloadState.Value = DownloadStatus.Downloading; + } + + private void downloadFailed(DownloadBeatmapSetRequest d) + { + if (d.BeatmapSet.OnlineBeatmapSetID == set.OnlineBeatmapSetID) + DownloadState.Value = DownloadStatus.NotDownloaded; + } + + public enum DownloadStatus + { + NotDownloaded, + Downloading, + Downloaded, } } } diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs index 4fce6a49fb..7a227f4bfa 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs @@ -61,20 +61,23 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons Action = () => { - if (!downloader.Download()) + if (downloader.DownloadState.Value == BeatmapSetDownloader.DownloadStatus.Downloading) { Content.MoveToX(-5, 50, Easing.OutSine).Then() .MoveToX(5, 100, Easing.InOutSine).Then() .MoveToX(-5, 100, Easing.InOutSine).Then() .MoveToX(0, 50, Easing.InSine); + return; } + + downloader.Download(); }; - downloader.Downloaded.ValueChanged += d => + downloader.DownloadState.ValueChanged += d => { - if (d) + if (d == BeatmapSetDownloader.DownloadStatus.Downloaded) this.FadeOut(200); - else + else if (d == BeatmapSetDownloader.DownloadStatus.NotDownloaded) this.FadeIn(200); }; } diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index e286837746..48963a91e8 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -168,11 +168,10 @@ namespace osu.Game.Overlays.Direct }, new DownloadButton(SetInfo) { - Size = new Vector2(30), + Size = new Vector2(50, 30), Margin = new MarginPadding(horizontal_padding), - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Colour = colours.Gray5, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, }, }, }, diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index e63c290ce5..76da4b61b0 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -99,6 +99,7 @@ namespace osu.Game.Overlays.Direct attachDownload(downloadRequest); beatmaps.BeatmapDownloadBegan += attachDownload; + beatmaps.ItemAdded += setAdded; } public override bool DisposeOnDeathRemoval => true; @@ -107,6 +108,7 @@ namespace osu.Game.Overlays.Direct { base.Dispose(isDisposing); beatmaps.BeatmapDownloadBegan -= attachDownload; + beatmaps.ItemAdded -= setAdded; } protected override void Update() @@ -171,6 +173,12 @@ namespace osu.Game.Overlays.Direct }; } + private void setAdded(BeatmapSetInfo s) + { + if (s.OnlineBeatmapSetID == SetInfo.OnlineBeatmapSetID) + progressBar.FadeOut(500); + } + protected override void LoadComplete() { base.LoadComplete(); diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 1ffa8dbd35..68380b951c 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -1,76 +1,146 @@ // 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.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Overlays.Direct { public class DownloadButton : OsuClickableContainer { private readonly SpriteIcon icon; + private readonly SpriteIcon checkmark; + private readonly BeatmapSetDownloader downloader; + private readonly Box background; + + private OsuColour colours; public DownloadButton(BeatmapSetInfo set, bool noVideo = false) { - BeatmapSetDownloader downloader; Children = new Drawable[] { downloader = new BeatmapSetDownloader(set, noVideo), + new Container + { + RelativeSizeAxes = Axes.Both, + CornerRadius = 17, + Masking = true, + Child = background = new Box + { + RelativeSizeAxes = Axes.Both, + }, + }, icon = new SpriteIcon { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(30), - Icon = FontAwesome.fa_osu_chevron_down_o, + Size = new Vector2(13), + Icon = FontAwesome.fa_download, }, + checkmark = new SpriteIcon + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + X = 8, + Size = Vector2.Zero, + Icon = FontAwesome.fa_check, + } }; Action = () => { - if (!downloader.Download()) + if (downloader.DownloadState.Value == BeatmapSetDownloader.DownloadStatus.Downloading) { Content.MoveToX(-5, 50, Easing.OutSine).Then() .MoveToX(5, 100, Easing.InOutSine).Then() .MoveToX(-5, 100, Easing.InOutSine).Then() .MoveToX(0, 50, Easing.InSine); } + else if (downloader.DownloadState.Value == BeatmapSetDownloader.DownloadStatus.Downloaded) + { + // TODO: Jump to song select with this set when the capability is implemented + } + else + { + downloader.Download(); + } }; - downloader.Downloaded.ValueChanged += d => - { - if (d) - this.FadeOut(200); - else - this.FadeIn(200); - }; + downloader.DownloadState.ValueChanged += _ => updateState(); + + Colour = Color4.White; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + updateState(); + } + + [BackgroundDependencyLoader(permitNulls:true)] + private void load(OsuColour colours) + { + this.colours = colours; } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - icon.ScaleTo(0.9f, 1000, Easing.Out); + Content.ScaleTo(0.9f, 1000, Easing.Out); return base.OnMouseDown(state, args); } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - icon.ScaleTo(1f, 500, Easing.OutElastic); + Content.ScaleTo(1f, 500, Easing.OutElastic); return base.OnMouseUp(state, args); } protected override bool OnHover(InputState state) { - icon.ScaleTo(1.1f, 500, Easing.OutElastic); + Content.ScaleTo(1.1f, 500, Easing.OutElastic); return base.OnHover(state); } protected override void OnHoverLost(InputState state) { - icon.ScaleTo(1f, 500, Easing.OutElastic); + Content.ScaleTo(1f, 500, Easing.OutElastic); + } + + private void updateState() + { + if (!IsLoaded) + return; + + switch (downloader.DownloadState.Value) + { + case BeatmapSetDownloader.DownloadStatus.NotDownloaded: + background.FadeColour(colours.Gray4, 500, Easing.InOutExpo); + icon.MoveToX(0, 500, Easing.InOutExpo); + checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo); + break; + + case BeatmapSetDownloader.DownloadStatus.Downloading: + background.FadeColour(colours.Blue, 500, Easing.InOutExpo); + icon.MoveToX(0, 500, Easing.InOutExpo); + checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo); + break; + + case BeatmapSetDownloader.DownloadStatus.Downloaded: + background.FadeColour(colours.Green, 500, Easing.InOutExpo); + icon.MoveToX(-8, 500, Easing.InOutExpo); + checkmark.ScaleTo(new Vector2(13), 500, Easing.InOutExpo); + break; + } } } } From 6ea6a10defeafddd5e698b5f6d41af42653d9335 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 3 Jul 2018 20:26:49 +0530 Subject: [PATCH 045/304] Reduce size of download button in list view to fit hover effect --- osu.Game/Overlays/Direct/DirectListPanel.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 812a0e2073..17c5153dab 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -120,8 +120,8 @@ namespace osu.Game.Overlays.Direct Alpha = 0, Child = new DownloadButton(SetInfo) { - Size = new Vector2(height - vertical_padding * 2), - Margin = new MarginPadding { Left = vertical_padding }, + Size = new Vector2(height - vertical_padding * 3), + Margin = new MarginPadding { Left = vertical_padding, Right = vertical_padding }, }, }, new FillFlowContainer From 2979cb96a6eae23852f245042a248966e5e802ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Odg=C3=A5rd=20T=C3=B8rring?= Date: Wed, 4 Jul 2018 21:09:28 +0200 Subject: [PATCH 046/304] attemptSeek accesses beatmap Disabled directly --- osu.Game/Overlays/MusicController.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index f7f0d7ec6a..94b69271fd 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -183,7 +183,7 @@ namespace osu.Game.Overlays Anchor = Anchor.BottomCentre, Height = progress_height, FillColour = colours.Yellow, - OnSeek = conditionalSeek + OnSeek = attemptSeek } }, }, @@ -198,9 +198,9 @@ namespace osu.Game.Overlays playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } - private void conditionalSeek(double progress) + private void attemptSeek(double progress) { - if (enableSeek) + if (!beatmap.Disabled) current?.Track.Seek(progress); } @@ -220,8 +220,6 @@ namespace osu.Game.Overlays base.LoadComplete(); } - private bool enableSeek { get; set; } - private void beatmapDisabledChanged(bool disabled) { if (disabled) @@ -231,7 +229,6 @@ namespace osu.Game.Overlays prevButton.Enabled.Value = !disabled; nextButton.Enabled.Value = !disabled; playlistButton.Enabled.Value = !disabled; - enableSeek = !disabled; } protected override void UpdateAfterChildren() From e28a6107578ae52d17298a6fc929d49ce17e5ca1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 Jul 2018 12:40:55 +0900 Subject: [PATCH 047/304] Fix mods not correctly resetting when changing ruleset at song select --- .../ManiaSettingsSubsection.cs | 5 ++- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 7 +++- .../Settings/RulesetSettingsSubsection.cs | 9 +++-- osu.Game/Rulesets/Mods/ModAutoplay.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 4 +- osu.Game/Screens/Select/SongSelect.cs | 38 +++++++++++++------ osu.Game/osu.Game.csproj | 2 +- 7 files changed, 46 insertions(+), 21 deletions(-) diff --git a/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs b/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs index 54a7bf954d..8d1fad8a82 100644 --- a/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs +++ b/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Overlays.Settings; +using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Mania.Configuration; using osu.Game.Rulesets.Mania.UI; @@ -19,14 +20,14 @@ namespace osu.Game.Rulesets.Mania } [BackgroundDependencyLoader] - private void load(ManiaConfigManager config) + private void load() { Children = new Drawable[] { new SettingsEnumDropdown { LabelText = "Scrolling direction", - Bindable = config.GetBindable(ManiaSetting.ScrollDirection) + Bindable = (Config as RulesetConfigManager)?.GetBindable(ManiaSetting.ScrollDirection) } }; } diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index c584a32a82..98cf111ba0 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -44,6 +44,8 @@ namespace osu.Game.Overlays.Mods private void rulesetChanged(RulesetInfo newRuleset) { + if (newRuleset == null) return; + var instance = newRuleset.CreateInstance(); foreach (ModSection section in ModSectionsContainer.Children) @@ -173,7 +175,10 @@ namespace osu.Game.Overlays.Mods refreshSelectedMods(); } - private void refreshSelectedMods() => SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray(); + private void refreshSelectedMods() + { + SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray(); + } public ModSelectOverlay() { diff --git a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs index 05104018cd..5340a01743 100644 --- a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs @@ -3,6 +3,7 @@ using osu.Framework.Allocation; using osu.Game.Rulesets; +using osu.Game.Rulesets.Configuration; namespace osu.Game.Overlays.Settings { @@ -14,6 +15,8 @@ namespace osu.Game.Overlays.Settings { private readonly Ruleset ruleset; + protected IRulesetConfigManager Config; + protected RulesetSettingsSubsection(Ruleset ruleset) { this.ruleset = ruleset; @@ -25,9 +28,9 @@ namespace osu.Game.Overlays.Settings { dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); - var config = dependencies.Get().GetConfigFor(ruleset); - if (config != null) - dependencies.Cache(config); + Config = dependencies.Get().GetConfigFor(ruleset); + if (Config != null) + dependencies.Cache(Config); return dependencies; } diff --git a/osu.Game/Rulesets/Mods/ModAutoplay.cs b/osu.Game/Rulesets/Mods/ModAutoplay.cs index 7058d1bed6..8f73ff4c2d 100644 --- a/osu.Game/Rulesets/Mods/ModAutoplay.cs +++ b/osu.Game/Rulesets/Mods/ModAutoplay.cs @@ -11,7 +11,7 @@ using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Mods { - public class ModAutoplay : ModAutoplay, IApplicableToRulesetContainer + public abstract class ModAutoplay : ModAutoplay, IApplicableToRulesetContainer where T : HitObject { protected virtual Score CreateReplayScore(Beatmap beatmap) => new Score { Replay = new Replay() }; diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 8ce40fcfa0..a346911ca2 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -84,10 +84,10 @@ namespace osu.Game.Screens.Select protected override void UpdateBeatmap(WorkingBeatmap beatmap) { - base.UpdateBeatmap(beatmap); - beatmap.Mods.BindTo(SelectedMods); + base.UpdateBeatmap(beatmap); + BeatmapDetails.Beatmap = beatmap; if (beatmap.Track != null) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 94c16f1797..e940cac419 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Linq; using OpenTK; using OpenTK.Input; using osu.Framework.Allocation; @@ -19,6 +20,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Overlays; using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Edit; using osu.Game.Screens.Menu; @@ -67,8 +69,17 @@ namespace osu.Game.Screens.Select protected new readonly Bindable Ruleset = new Bindable(); private DependencyContainer dependencies; + protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) - => dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + { + dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + + dependencies.CacheAs(this); + dependencies.CacheAs(Ruleset); + dependencies.CacheAs>(Ruleset); + + return dependencies; + } protected SongSelect() { @@ -183,11 +194,9 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader(true)] private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours) { - dependencies.CacheAs(this); - dependencies.CacheAs(Ruleset); - dependencies.CacheAs>(Ruleset); - + // manual binding to parent ruleset to allow for delayed load in the incoming direction. base.Ruleset.ValueChanged += r => updateSelectedBeatmap(beatmapNoDebounce); + Ruleset.ValueChanged += r => base.Ruleset.Value = r; if (Footer != null) { @@ -263,7 +272,7 @@ namespace osu.Game.Screens.Select // If selecting new beatmap without bypassing filters failed, there's possibly a ruleset mismatch if (beatmap?.BeatmapInfo?.Ruleset != null && beatmap.BeatmapInfo.Ruleset != Ruleset.Value) { - Ruleset.Value = beatmap.BeatmapInfo.Ruleset; + base.Ruleset.Value = beatmap.BeatmapInfo.Ruleset; Carousel.SelectBeatmap(beatmap.BeatmapInfo); } } @@ -281,16 +290,22 @@ namespace osu.Game.Screens.Select void performLoad() { + WorkingBeatmap working = Beatmap.Value; + bool preview = false; + // We may be arriving here due to another component changing the bindable Beatmap. // In these cases, the other component has already loaded the beatmap, so we don't need to do so again. if (beatmap?.Equals(Beatmap.Value.BeatmapInfo) != true) { - bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID; - - Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value); - ensurePlayingSelected(preview); + preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID; + working = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value); } + ensurePlayingSelected(preview); + + working.Mods.Value = Enumerable.Empty(); + + Beatmap.Value = working; Ruleset.Value = ruleset; UpdateBeatmap(Beatmap.Value); @@ -464,7 +479,8 @@ namespace osu.Game.Screens.Select private void carouselBeatmapsLoaded() { - if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false && Beatmap.Value.BeatmapSetInfo?.Protected == false && Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false)) + if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false && Beatmap.Value.BeatmapSetInfo?.Protected == false + && Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false)) return; if (Carousel.SelectedBeatmapSet == null && !Carousel.SelectNextRandom()) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 56c33c47af..74da553bfe 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 1d6609d9f3688ddfd5ee76818db001fb5877225d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 Jul 2018 11:32:09 +0900 Subject: [PATCH 048/304] Add common custom words to dotsettings dictionary Also fixes some typos and reduces spelling suggestions to hints. --- osu.Desktop/Program.cs | 4 +-- .../TestCaseCatcherArea.cs | 2 +- ...tCaseHyperdash.cs => TestCaseHyperDash.cs} | 4 +-- .../Difficulty/CatchDifficultyCalculator.cs | 4 +-- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 26 +++++++++---------- .../Legacy/EndTimeObjectPatternGenerator.cs | 4 +-- .../OsuBeatmapConversionTest.cs | 2 +- .../Difficulty/OsuDifficultyCalculator.cs | 8 +++--- osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs | 4 +-- .../Connections/FollowPointRenderer.cs | 8 +++--- .../Objects/Drawables/DrawableHitCircle.cs | 2 +- .../Objects/Drawables/DrawableOsuHitObject.cs | 2 +- .../Objects/Drawables/DrawableSpinner.cs | 2 +- .../Objects/Drawables/Pieces/SliderBody.cs | 2 +- osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 4 +-- osu.Game.Rulesets.Osu/Objects/SliderTick.cs | 2 +- .../Visual/TestCaseBeatmapInfoWedge.cs | 6 ++--- osu.Game.Tests/Visual/TestCaseMods.cs | 4 +-- osu.Game/Graphics/SpriteIcon.cs | 1 + osu.sln.DotSettings | 23 +++++++++++++++- 20 files changed, 67 insertions(+), 47 deletions(-) rename osu.Game.Rulesets.Catch.Tests/{TestCaseHyperdash.cs => TestCaseHyperDash.cs} (88%) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 61d2006315..780a9994fd 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -21,7 +21,7 @@ namespace osu.Desktop // required to initialise native SQLite libraries on some platforms. if (!RuntimeInfo.IsMono) - useMulticoreJit(); + useMultiCoreJit(); // Back up the cwd before DesktopGameHost changes it var cwd = Environment.CurrentDirectory; @@ -54,7 +54,7 @@ namespace osu.Desktop } } - private static void useMulticoreJit() + private static void useMultiCoreJit() { #if NET_FRAMEWORK var directory = Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Profiles")); diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseCatcherArea.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseCatcherArea.cs index 0ba6398ced..25f7ca108d 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestCaseCatcherArea.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestCaseCatcherArea.cs @@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Catch.Tests { } - public void ToggleHyperDash(bool status) => MovableCatcher.SetHyperdashState(status ? 2 : 1); + public void ToggleHyperDash(bool status) => MovableCatcher.SetHyperDashState(status ? 2 : 1); } } } diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseHyperdash.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs similarity index 88% rename from osu.Game.Rulesets.Catch.Tests/TestCaseHyperdash.cs rename to osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs index 896582bf0a..14487b2c7f 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestCaseHyperdash.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs @@ -8,9 +8,9 @@ using osu.Game.Rulesets.Catch.Objects; namespace osu.Game.Rulesets.Catch.Tests { [TestFixture] - public class TestCaseHyperdash : Game.Tests.Visual.TestCasePlayer + public class TestCaseHyperDash : Game.Tests.Visual.TestCasePlayer { - public TestCaseHyperdash() + public TestCaseHyperDash() : base(new CatchRuleset()) { } diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index 3d1013aad3..31c56c37c4 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -61,12 +61,12 @@ namespace osu.Game.Rulesets.Catch.Difficulty return new CatchDifficultyAttributes(mods, 0); // this is the same as osu!, so there's potential to share the implementation... maybe - double preEmpt = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; + double preempt = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; double starRating = Math.Sqrt(calculateDifficulty(difficultyHitObjects, timeRate)) * star_scaling_factor; return new CatchDifficultyAttributes(mods, starRating) { - ApproachRate = preEmpt > 1200.0 ? -(preEmpt - 1800.0) / 120.0 : -(preEmpt - 1200.0) / 150.0 + 5.0, + ApproachRate = preempt > 1200.0 ? -(preempt - 1800.0) / 120.0 : -(preempt - 1200.0) / 150.0 + 5.0, MaxCombo = difficultyHitObjects.Count }; } diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 9c376f340a..2f42902fd0 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -255,11 +255,11 @@ namespace osu.Game.Rulesets.Catch.UI double positionDifference = target.X * CatchPlayfield.BASE_WIDTH - catcherPosition; double velocity = positionDifference / Math.Max(1.0, timeDifference - 1000.0 / 60.0); - SetHyperdashState(Math.Abs(velocity), target.X); + SetHyperDashState(Math.Abs(velocity), target.X); } else { - SetHyperdashState(); + SetHyperDashState(); } return validCatch; @@ -270,18 +270,18 @@ namespace osu.Game.Rulesets.Catch.UI private float hyperDashTargetPosition; /// - /// Whether we are hypderdashing or not. + /// Whether we are hyper-dashing or not. /// public bool HyperDashing => hyperDashModifier != 1; /// - /// Set hyperdash state. + /// Set hyper-dash state. /// - /// The speed multiplier. If this is less or equals to 1, this catcher will be non-hyperdashing state. - /// When this catcher crosses this position, this catcher ends hyperdashing. - public void SetHyperdashState(double modifier = 1, float targetPosition = -1) + /// The speed multiplier. If this is less or equals to 1, this catcher will be non-hyper-dashing state. + /// When this catcher crosses this position, this catcher ends hyper-dashing. + public void SetHyperDashState(double modifier = 1, float targetPosition = -1) { - const float hyperdash_transition_length = 180; + const float hyper_dash_transition_length = 180; bool previouslyHyperDashing = HyperDashing; if (modifier <= 1 || X == targetPosition) @@ -291,8 +291,8 @@ namespace osu.Game.Rulesets.Catch.UI if (previouslyHyperDashing) { - this.FadeColour(Color4.White, hyperdash_transition_length, Easing.OutQuint); - this.FadeTo(1, hyperdash_transition_length, Easing.OutQuint); + this.FadeColour(Color4.White, hyper_dash_transition_length, Easing.OutQuint); + this.FadeTo(1, hyper_dash_transition_length, Easing.OutQuint); } } else @@ -303,8 +303,8 @@ namespace osu.Game.Rulesets.Catch.UI if (!previouslyHyperDashing) { - this.FadeColour(Color4.OrangeRed, hyperdash_transition_length, Easing.OutQuint); - this.FadeTo(0.2f, hyperdash_transition_length, Easing.OutQuint); + this.FadeColour(Color4.OrangeRed, hyper_dash_transition_length, Easing.OutQuint); + this.FadeTo(0.2f, hyper_dash_transition_length, Easing.OutQuint); Trail = true; } } @@ -370,7 +370,7 @@ namespace osu.Game.Rulesets.Catch.UI hyperDashDirection < 0 && hyperDashTargetPosition > X) { X = hyperDashTargetPosition; - SetHyperdashState(); + SetHyperDashState(); } } diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs index 3f34afee85..01b2b1e68e 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs @@ -19,9 +19,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy public EndTimeObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, IBeatmap originalBeatmap) : base(random, hitObject, beatmap, new Pattern(), originalBeatmap) { - var endtimeData = HitObject as IHasEndTime; - - endTime = endtimeData?.EndTime ?? 0; + endTime = (HitObject as IHasEndTime)?.EndTime ?? 0; } public override Pattern Generate() diff --git a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs index 3fa039d946..3a551bbbcf 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs @@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Osu.Tests public struct ConvertValue : IEquatable { /// - /// A sane value to account for osu!stable using ints everwhere. + /// A sane value to account for osu!stable using s everywhere. /// private const double conversion_lenience = 2; diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 62fafd8196..5e91ed7a97 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -61,19 +61,19 @@ namespace osu.Game.Rulesets.Osu.Difficulty double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier; double starRating = aimRating + speedRating + Math.Abs(aimRating - speedRating) / 2; - // Todo: These int casts are temporary to achieve 1:1 results with osu!stable, and should be remoevd in the future + // Todo: These int casts are temporary to achieve 1:1 results with osu!stable, and should be removed in the future double hitWindowGreat = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate; - double preEmpt = (int)BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; + double preempt = (int)BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; int maxCombo = beatmap.HitObjects.Count(); - // Add the ticks + tail of the slider. 1 is subtracted because the "headcircle" would be counted twice (once for the slider itself in the line above) + // Add the ticks + tail of the slider. 1 is subtracted because the head circle would be counted twice (once for the slider itself in the line above) maxCombo += beatmap.HitObjects.OfType().Sum(s => s.NestedHitObjects.Count - 1); return new OsuDifficultyAttributes(mods, starRating) { AimStrain = aimRating, SpeedStrain = speedRating, - ApproachRate = preEmpt > 1200 ? (1800 - preEmpt) / 120 : (1200 - preEmpt) / 150 + 5, + ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5, OverallDifficulty = (80 - hitWindowGreat) / 6, MaxCombo = maxCombo }; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs b/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs index 4220b72b16..4eff2a55c8 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override void ApplyToDrawableHitObjects(IEnumerable drawables) { - void adjustFadeIn(OsuHitObject h) => h.TimeFadein = h.TimePreempt * fade_in_duration_multiplier; + void adjustFadeIn(OsuHitObject h) => h.TimeFadeIn = h.TimePreempt * fade_in_duration_multiplier; foreach (var d in drawables.OfType()) { @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Mods var h = d.HitObject; - var fadeOutStartTime = h.StartTime - h.TimePreempt + h.TimeFadein; + var fadeOutStartTime = h.StartTime - h.TimePreempt + h.TimeFadeIn; var fadeOutDuration = h.TimePreempt * fade_out_duration_multiplier; // new duration from completed fade in to end (before fading out) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs index 4653f45149..4ac3b0c983 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs @@ -96,12 +96,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections using (fp.BeginAbsoluteSequence(fadeInTime)) { - fp.FadeIn(currHitObject.TimeFadein); - fp.ScaleTo(1, currHitObject.TimeFadein, Easing.Out); + fp.FadeIn(currHitObject.TimeFadeIn); + fp.ScaleTo(1, currHitObject.TimeFadeIn, Easing.Out); - fp.MoveTo(pointEndPosition, currHitObject.TimeFadein, Easing.Out); + fp.MoveTo(pointEndPosition, currHitObject.TimeFadeIn, Easing.Out); - fp.Delay(fadeOutTime - fadeInTime).FadeOut(currHitObject.TimeFadein); + fp.Delay(fadeOutTime - fadeInTime).FadeOut(currHitObject.TimeFadeIn); } fp.Expire(true); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 421c93d485..c525b4bd97 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { base.UpdatePreemptState(); - ApproachCircle.FadeIn(Math.Min(HitObject.TimeFadein * 2, HitObject.TimePreempt)); + ApproachCircle.FadeIn(Math.Min(HitObject.TimeFadeIn * 2, HitObject.TimePreempt)); ApproachCircle.ScaleTo(1.1f, HitObject.TimePreempt); } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 7c9503dfe2..02def2189f 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables AccentColour = skin.GetValue(s => s.ComboColours.Count > 0 ? s.ComboColours[combo.ComboIndex % s.ComboColours.Count] : (Color4?)null) ?? Color4.White; } - protected virtual void UpdatePreemptState() => this.FadeIn(HitObject.TimeFadein); + protected virtual void UpdatePreemptState() => this.FadeIn(HitObject.TimeFadeIn); protected virtual void UpdateCurrentState(ArmedState state) { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 10539f85a2..1d3df69fb8 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -167,7 +167,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { Disc.Tracking = OsuActionInputManager.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton); if (!spmCounter.IsPresent && Disc.Tracking) - spmCounter.FadeIn(HitObject.TimeFadein); + spmCounter.FadeIn(HitObject.TimeFadeIn); base.Update(); } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs index 94a61e7904..283d6b91f6 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -212,7 +212,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces var spanProgress = slider.ProgressAt(completionProgress); double start = 0; - double end = SnakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / slider.TimeFadein, 0, 1) : 1; + double end = SnakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / slider.TimeFadeIn, 0, 1) : 1; if (span >= slider.SpanCount() - 1) { diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index befbc01f3c..48a6365c00 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Objects public event Action PositionChanged; public double TimePreempt = 600; - public double TimeFadein = 400; + public double TimeFadeIn = 400; private Vector2 position; @@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Osu.Objects base.ApplyDefaultsToSelf(controlPointInfo, difficulty); TimePreempt = (float)BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1800, 1200, 450); - TimeFadein = (float)BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1200, 800, 300); + TimeFadeIn = (float)BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1200, 800, 300); Scale = (1.0f - 0.7f * (difficulty.CircleSize - 5) / 5) / 2; } diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs index 4db6eb9883..54337a12be 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Objects // This is so on repeats ticks don't appear too late to be visually processed by the player. offset = 200; else - offset = TimeFadein * 0.66f; + offset = TimeFadeIn * 0.66f; TimePreempt = (StartTime - SpanStartTime) / 2 + offset; } diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index ee66f53ddc..b232180eba 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -110,8 +110,8 @@ namespace osu.Game.Tests.Visual private void testInfoLabels(int expectedCount) { - AddAssert("check infolabels exists", () => infoWedge.Info.InfoLabelContainer.Children.Any()); - AddAssert("check infolabels count", () => infoWedge.Info.InfoLabelContainer.Children.Count == expectedCount); + AddAssert("check info labels exists", () => infoWedge.Info.InfoLabelContainer.Children.Any()); + AddAssert("check info labels count", () => infoWedge.Info.InfoLabelContainer.Children.Count == expectedCount); } private void testNullBeatmap() @@ -121,7 +121,7 @@ namespace osu.Game.Tests.Visual 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); AddAssert("check empty author", () => !infoWedge.Info.MapperContainer.Children.Any()); - AddAssert("check no infolabels", () => !infoWedge.Info.InfoLabelContainer.Children.Any()); + AddAssert("check no info labels", () => !infoWedge.Info.InfoLabelContainer.Children.Any()); } private void selectBeatmap(IBeatmap b) diff --git a/osu.Game.Tests/Visual/TestCaseMods.cs b/osu.Game.Tests/Visual/TestCaseMods.cs index 73c37348d5..1a28442e38 100644 --- a/osu.Game.Tests/Visual/TestCaseMods.cs +++ b/osu.Game.Tests/Visual/TestCaseMods.cs @@ -114,7 +114,7 @@ namespace osu.Game.Tests.Visual testMultiplierTextColour(noFailMod, modSelect.LowMultiplierColour); testMultiplierTextColour(hiddenMod, modSelect.HighMultiplierColour); - testUnimplmentedMod(autoPilotMod); + testUnimplementedMod(autoPilotMod); } private void testManiaMods(ManiaRuleset ruleset) @@ -154,7 +154,7 @@ namespace osu.Game.Tests.Visual checkNotSelected(mod); } - private void testUnimplmentedMod(Mod mod) + private void testUnimplementedMod(Mod mod) { selectNext(mod); checkNotSelected(mod); diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index 6acd20719e..45c4cebfcf 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -10,6 +10,7 @@ using osu.Framework.IO.Stores; using OpenTK; using OpenTK.Graphics; using osu.Framework.Caching; +// ReSharper disable IdentifierTypo namespace osu.Game.Graphics { diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 0b631d008b..1f1b6a79b1 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -23,6 +23,7 @@ HINT SUGGESTION HINT + HINT HINT WARNING WARNING @@ -43,6 +44,7 @@ DO_NOT_SHOW WARNING WARNING + HINT HINT ERROR HINT @@ -133,6 +135,7 @@ WARNING WARNING WARNING + HINT DO_NOT_SHOW DO_NOT_SHOW DO_NOT_SHOW @@ -666,4 +669,22 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste True True True - True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True From 625b9ead4c1eec712824d59b91bf7cd00479cb3c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 Jul 2018 21:00:23 +0900 Subject: [PATCH 049/304] Fix links from profile top scores to beatmaps not working correctly --- osu.Game/Beatmaps/BeatmapMetadata.cs | 1 - osu.Game/Online/API/Requests/Responses/APIScore.cs | 9 ++++++++- .../Profile/Sections/BeatmapMetadataContainer.cs | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapMetadata.cs b/osu.Game/Beatmaps/BeatmapMetadata.cs index 6c1bcd0531..57983ec568 100644 --- a/osu.Game/Beatmaps/BeatmapMetadata.cs +++ b/osu.Game/Beatmaps/BeatmapMetadata.cs @@ -14,7 +14,6 @@ namespace osu.Game.Beatmaps public class BeatmapMetadata : IEquatable { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - [JsonIgnore] public int ID { get; set; } public string Title { get; set; } diff --git a/osu.Game/Online/API/Requests/Responses/APIScore.cs b/osu.Game/Online/API/Requests/Responses/APIScore.cs index a398bf46ee..25eb32a79f 100644 --- a/osu.Game/Online/API/Requests/Responses/APIScore.cs +++ b/osu.Game/Online/API/Requests/Responses/APIScore.cs @@ -63,7 +63,14 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"beatmapset")] private BeatmapMetadata metadata { - set => Beatmap.Metadata = value; + set + { + // extract the set ID to its correct place. + Beatmap.BeatmapSet = new BeatmapSetInfo { OnlineBeatmapSetID = value.ID }; + value.ID = 0; + + Beatmap.Metadata = value; + } } [JsonProperty(@"statistics")] diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs index 359bfc7564..eaa0ac4aaa 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs @@ -9,6 +9,7 @@ using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; + namespace osu.Game.Overlays.Profile.Sections { /// @@ -32,7 +33,10 @@ namespace osu.Game.Overlays.Profile.Sections { Action = () => { - if (beatmap.BeatmapSet?.OnlineBeatmapSetID != null) beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.BeatmapSet.OnlineBeatmapSetID.Value); + if (beatmap.OnlineBeatmapID != null) + beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.OnlineBeatmapID.Value); + else if (beatmap.BeatmapSet?.OnlineBeatmapSetID != null) + beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.BeatmapSet.OnlineBeatmapSetID.Value); }; Child = new FillFlowContainer From a1d2092cc9ab5cfa0537d1f80aa9a09373d16920 Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Fri, 6 Jul 2018 13:29:40 +0900 Subject: [PATCH 050/304] Fix incorrect default drain time --- .../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 8ef942c683..55081e5822 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs @@ -107,7 +107,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int drainTime = (int)(((lastObject?.StartTime ?? 0) - (firstObject?.StartTime ?? 0) - OriginalBeatmap.TotalBreakTime) / 1000); if (drainTime == 0) - drainTime = 100000; + drainTime = 10000; BeatmapDifficulty difficulty = OriginalBeatmap.BeatmapInfo.BaseDifficulty; conversionDifficulty = ((difficulty.DrainRate + MathHelper.Clamp(difficulty.ApproachRate, 4, 7)) / 1.5 + (double)OriginalBeatmap.HitObjects.Count() / drainTime * 9f) / 38f * 5f / 1.15; From b8d314a809c7b39a20d97a35373181954fdbddf9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 Jul 2018 16:39:27 +0900 Subject: [PATCH 051/304] Tidy up updater namespace --- osu.Desktop/OsuGameDesktop.cs | 85 ++++++++++--------- osu.Desktop/Overlays/VersionManager.cs | 4 - .../SquirrelUpdateManager.cs | 5 +- 3 files changed, 48 insertions(+), 46 deletions(-) rename osu.Desktop/{Overlays => Updater}/SquirrelUpdateManager.cs (97%) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 64adcecba4..d27bd70cda 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -12,6 +12,7 @@ using osu.Framework.Platform; using osu.Game; using OpenTK.Input; using Microsoft.Win32; +using osu.Desktop.Updater; using osu.Framework.Platform.Windows; namespace osu.Desktop @@ -38,6 +39,50 @@ namespace osu.Desktop } } + protected override void LoadComplete() + { + base.LoadComplete(); + + if (!noVersionOverlay) + { + LoadComponentAsync(new VersionManager { Depth = int.MinValue }, v => + { + Add(v); + v.State = Visibility.Visible; + }); + +#if NET_FRAMEWORK + Add(new SquirrelUpdateManager()); +#endif + } + } + + public override void SetHost(GameHost host) + { + base.SetHost(host); + var desktopWindow = host.Window as DesktopGameWindow; + if (desktopWindow != null) + { + desktopWindow.CursorState |= CursorState.Hidden; + + desktopWindow.SetIconFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(GetType(), "lazer.ico")); + desktopWindow.Title = Name; + + desktopWindow.FileDrop += fileDrop; + } + } + + private void fileDrop(object sender, FileDropEventArgs e) + { + var filePaths = new[] { e.FileName }; + + var firstExtension = Path.GetExtension(filePaths.First()); + + if (filePaths.Any(f => Path.GetExtension(f) != firstExtension)) return; + + Task.Factory.StartNew(() => Import(filePaths), TaskCreationOptions.LongRunning); + } + /// /// A method of accessing an osu-stable install in a controlled fashion. /// @@ -77,45 +122,5 @@ namespace osu.Desktop { } } - - protected override void LoadComplete() - { - base.LoadComplete(); - - if (!noVersionOverlay) - { - LoadComponentAsync(new VersionManager { Depth = int.MinValue }, v => - { - Add(v); - v.State = Visibility.Visible; - }); - } - } - - public override void SetHost(GameHost host) - { - base.SetHost(host); - var desktopWindow = host.Window as DesktopGameWindow; - if (desktopWindow != null) - { - desktopWindow.CursorState |= CursorState.Hidden; - - desktopWindow.SetIconFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(GetType(), "lazer.ico")); - desktopWindow.Title = Name; - - desktopWindow.FileDrop += fileDrop; - } - } - - private void fileDrop(object sender, FileDropEventArgs e) - { - var filePaths = new[] { e.FileName }; - - var firstExtension = Path.GetExtension(filePaths.First()); - - if (filePaths.Any(f => Path.GetExtension(f) != firstExtension)) return; - - Task.Factory.StartNew(() => Import(filePaths), TaskCreationOptions.LongRunning); - } } } diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index bc1faec822..1129969694 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -91,10 +91,6 @@ namespace osu.Desktop.Overlays } } }; - -#if NET_FRAMEWORK - Add(new SquirrelUpdateManager()); -#endif } protected override void LoadComplete() diff --git a/osu.Desktop/Overlays/SquirrelUpdateManager.cs b/osu.Desktop/Updater/SquirrelUpdateManager.cs similarity index 97% rename from osu.Desktop/Overlays/SquirrelUpdateManager.cs rename to osu.Desktop/Updater/SquirrelUpdateManager.cs index ea86d2f028..81da26cff2 100644 --- a/osu.Desktop/Overlays/SquirrelUpdateManager.cs +++ b/osu.Desktop/Updater/SquirrelUpdateManager.cs @@ -3,6 +3,7 @@ #if NET_FRAMEWORK using System; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -16,7 +17,7 @@ using OpenTK; using OpenTK.Graphics; using Squirrel; -namespace osu.Desktop.Overlays +namespace osu.Desktop.Updater { public class SquirrelUpdateManager : Component { @@ -35,7 +36,7 @@ namespace osu.Desktop.Overlays notificationOverlay = notification; if (game.IsDeployedBuild) - Schedule(() => checkForUpdateAsync()); + Schedule(() => Task.Run(() => checkForUpdateAsync())); } private async void checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null) From 7120408a634ef1b272a7dde57e190b74707a9a8b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 Jul 2018 16:39:42 +0900 Subject: [PATCH 052/304] Add fallback "updater", which prompts the user to update --- osu.Desktop/OsuGameDesktop.cs | 2 + osu.Desktop/Updater/SimpleUpdateManager.cs | 103 +++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 osu.Desktop/Updater/SimpleUpdateManager.cs diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index d27bd70cda..a4270f22b4 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -53,6 +53,8 @@ namespace osu.Desktop #if NET_FRAMEWORK Add(new SquirrelUpdateManager()); +#else + Add(new SimpleUpdateManager()); #endif } } diff --git a/osu.Desktop/Updater/SimpleUpdateManager.cs b/osu.Desktop/Updater/SimpleUpdateManager.cs new file mode 100644 index 0000000000..cda8e6a7ca --- /dev/null +++ b/osu.Desktop/Updater/SimpleUpdateManager.cs @@ -0,0 +1,103 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Newtonsoft.Json; +using osu.Framework; +using osu.Framework.Allocation; +using osu.Framework.Graphics.Containers; +using osu.Framework.IO.Network; +using osu.Framework.Platform; +using osu.Game; +using osu.Game.Graphics; +using osu.Game.Overlays; +using osu.Game.Overlays.Notifications; + +namespace osu.Desktop.Updater +{ + /// + /// An update manager that shows notifications if a newer release is detected. + /// Installation is left up to the user. + /// + internal class SimpleUpdateManager : CompositeDrawable + { + private NotificationOverlay notificationOverlay; + private string version; + private GameHost host; + + [BackgroundDependencyLoader] + private void load(NotificationOverlay notification, OsuGameBase game, GameHost host) + { + notificationOverlay = notification; + + this.host = host; + version = game.Version; + + if (game.IsDeployedBuild) + Schedule(() => Task.Run(() => checkForUpdateAsync())); + } + + private async void checkForUpdateAsync() + { + var releases = new JsonWebRequest("https://api.github.com/repos/ppy/osu/releases/latest"); + await releases.PerformAsync(); + + var latest = releases.ResponseObject; + + if (latest.TagName != version) + { + notificationOverlay.Post(new SimpleNotification + { + Text = $"A newer release of osu! has been found ({version} → {latest.TagName}).\n\n" + + "Click here to download the new version, which can be installed over the top of your existing installation", + Icon = FontAwesome.fa_upload, + Activated = () => + { + host.OpenUrlExternally(getBestUrl(latest)); + return true; + } + }); + } + } + + private string getBestUrl(GitHubRelease release) + { + GitHubAsset bestAsset = null; + + switch (RuntimeInfo.OS) + { + case RuntimeInfo.Platform.Windows: + bestAsset = release.Assets?.FirstOrDefault(f => f.Name.EndsWith(".exe")); + break; + case RuntimeInfo.Platform.MacOsx: + bestAsset = release.Assets?.FirstOrDefault(f => f.Name.EndsWith(".dmg")); + break; + } + + return bestAsset?.BrowserDownloadUrl ?? release.HtmlUrl; + } + + public class GitHubRelease + { + [JsonProperty("html_url")] + public string HtmlUrl { get; set; } + + [JsonProperty("tag_name")] + public string TagName { get; set; } + + [JsonProperty("assets")] + public List Assets { get; set; } + } + + public class GitHubAsset + { + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("browser_download_url")] + public string BrowserDownloadUrl { get; set; } + } + } +} From c025158735b96c275d8d31b13c27305c1ba3a271 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 Jul 2018 17:53:01 +0900 Subject: [PATCH 053/304] Give VisibleState a default rather than nullable --- osu.Game/Screens/Menu/Button.cs | 4 ++-- osu.Game/Screens/Menu/ButtonSystem.cs | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index f862905b5e..29820f234d 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -39,7 +39,7 @@ namespace osu.Game.Screens.Menu /// /// The menu state for which we are visible for. /// - public ButtonSystemState? VisibleState; + public ButtonSystemState VisibleState = ButtonSystemState.TopLevel; private readonly Action clickAction; private readonly Key triggerKey; @@ -300,7 +300,7 @@ namespace osu.Game.Screens.Menu State = ButtonState.Contracted; break; default: - if (!VisibleState.HasValue || value == VisibleState) + if (value == VisibleState) State = ButtonState.Expanded; else if (value < VisibleState) State = ButtonState.Contracted; diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 4f2437cf01..1a0cd4fa5b 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -73,10 +73,7 @@ namespace osu.Game.Screens.Menu buttonArea.AddRange(new[] { - new Button(@"settings", string.Empty, FontAwesome.fa_gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O) - { - VisibleState = ButtonSystemState.TopLevel, - }, + new Button(@"settings", string.Empty, FontAwesome.fa_gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O), backButton = new Button(@"back", @"button-back-select", FontAwesome.fa_osu_left_o, new Color4(51, 58, 94, 255), () => State = ButtonSystemState.TopLevel, -WEDGE_WIDTH) { VisibleState = ButtonSystemState.Play, @@ -98,7 +95,6 @@ namespace osu.Game.Screens.Menu buttonsTopLevel.Add(new Button(@"osu!editor", @"button-generic-select", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E)); buttonsTopLevel.Add(new Button(@"osu!direct", @"button-direct-select", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D)); buttonsTopLevel.Add(new Button(@"exit", string.Empty, FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), () => OnExit?.Invoke(), 0, Key.Q)); - buttonsTopLevel.ForEach(b => b.VisibleState = ButtonSystemState.TopLevel); buttonArea.AddRange(buttonsPlay); buttonArea.AddRange(buttonsTopLevel); From f92a90c098002fd4ea63052e3ca681944ffcfa64 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 8 Jul 2018 02:03:42 +0900 Subject: [PATCH 054/304] Update README.md --- README.md | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9d19f16ebd..c270da198f 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,32 @@ # osu! [![Build status](https://ci.appveyor.com/api/projects/status/u2p01nx7l6og8buh?svg=true)](https://ci.appveyor.com/project/peppy/osu) [![CodeFactor](https://www.codefactor.io/repository/github/ppy/osu/badge)](https://www.codefactor.io/repository/github/ppy/osu) [![dev chat](https://discordapp.com/api/guilds/188630481301012481/widget.png?style=shield)](https://discord.gg/ppy) -Rhythm is just a *click* away. The future of [osu!](https://osu.ppy.sh) and the beginning of an open era! +Rhythm is just a *click* away. The future of [osu!](https://osu.ppy.sh) and the beginning of an open era! Commonly known by the codename "osu!lazer". Pew pew. # Status -This is still heavily under development and is not intended for end-user use. This repository is intended for developer collaboration. You're welcome to try and use it but please do not submit bug reports without a patch. Please do not ask for help building or using this software. +This project is still heavily under development, but is in a state where users are encouraged to try it out and keep it installed alongside the stable osu! client. It will continue to evolve over the coming months and hopefully bring some new unique features to the table. + +We are accepting bug reports (please report with as much detail as possible). Feature requests are welcome as long as you read and understand the contribution guidelines listed below. # Requirements -- A desktop platform that can compile .NET 4.7.1. We recommend using [Visual Studio Community Edition](https://www.visualstudio.com/) (Windows), [Visual Studio for Mac](https://www.visualstudio.com/vs/visual-studio-mac/) (macOS) or [MonoDevelop](http://www.monodevelop.com/download/) (Linux), all of which are free. [Visual Studio Code](https://code.visualstudio.com/) may also be used but requires further setup steps which are not covered here. +- A desktop platform with the [.NET Core SDK 2.1](https://www.microsoft.com/net/learn/get-started) or higher installed. +- When working with the codebase, we recommend using an IDE with intellisense and syntax highlighting, such as [Visual Studio Community Edition](https://www.visualstudio.com/) (Windows), [Visual Studio Code](https://code.visualstudio.com/) (with the C# plugin installed) or [Jetbrains Rider](https://www.jetbrains.com/rider/) (commercial). -# Getting Started -- Clone the repository including submodules (`git clone --recurse-submodules https://github.com/ppy/osu`) -- Build in your IDE of choice (recommended IDEs automatically restore nuget packages; if you are using an alternative make sure to `nuget restore`) +# Building and running + +If you are not interested in developing the game, please head over to the [releases](https://github.com/ppy/osu/releases) to download a precompiled build with automatic updating enabled (download and run the install executable for your platform). + +Clone the repository including submodules + +`git clone --recurse-submodules https://github.com/ppy/osu` + +Build and run + +- Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included) +- From command line using `dotnet run --project osu.Desktop --framework netcoreapp2.1` + +The above methods should automatically do so, but if you run into issues building you may need to `nuget restore`. # Contributing From 27311ce1fcfaa228cb3675d04361a92db6b38792 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 8 Jul 2018 11:21:18 +0900 Subject: [PATCH 055/304] Update nuget restore instructions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c270da198f..fd0ba838cc 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Build and run - Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included) - From command line using `dotnet run --project osu.Desktop --framework netcoreapp2.1` -The above methods should automatically do so, but if you run into issues building you may need to `nuget restore`. +The above methods should automatically do so, but if you run into issues building you may need to restore nuget packages (commonly via `dotnet restore`). # Contributing From e223074876d09c8897a8aa4af88f01a6446d157b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 9 Jul 2018 00:24:55 +0900 Subject: [PATCH 056/304] Fix import failures if single set has multiple conflicting OnlineBeatmapIDs Resolves #2970. --- osu.Game/Beatmaps/BeatmapManager.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index e488dacf80..fd24e4297b 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -339,6 +339,8 @@ namespace osu.Game.Beatmaps { var beatmapInfos = new List(); + bool invalidateOnlineIDs = false; + foreach (var name in reader.Filenames.Where(f => f.EndsWith(".osu"))) { using (var raw = reader.GetStream(name)) @@ -355,9 +357,18 @@ namespace osu.Game.Beatmaps beatmap.BeatmapInfo.Hash = ms.ComputeSHA2Hash(); beatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash(); - // check that no existing beatmap exists that is imported with the same online beatmap ID. if so, give it precedence. - if (beatmap.BeatmapInfo.OnlineBeatmapID.HasValue && QueryBeatmap(b => b.OnlineBeatmapID.Value == beatmap.BeatmapInfo.OnlineBeatmapID.Value) != null) - beatmap.BeatmapInfo.OnlineBeatmapID = null; + if (beatmap.BeatmapInfo.OnlineBeatmapID.HasValue) + { + var ourId = beatmap.BeatmapInfo.OnlineBeatmapID; + + // check that no existing beatmap in database exists that is imported with the same online beatmap ID. if so, give it precedence. + if (QueryBeatmap(b => b.OnlineBeatmapID.Value == ourId) != null) + beatmap.BeatmapInfo.OnlineBeatmapID = null; + + // check that no other beatmap in this imported set has a conflicting online beatmap ID. If so, presume *all* are incorrect. + if (beatmapInfos.Any(b => b.OnlineBeatmapID == ourId)) + invalidateOnlineIDs = true; + } RulesetInfo ruleset = rulesets.GetRuleset(beatmap.BeatmapInfo.RulesetID); @@ -375,6 +386,9 @@ namespace osu.Game.Beatmaps } } + if (invalidateOnlineIDs) + beatmapInfos.ForEach(b => b.OnlineBeatmapID = null); + return beatmapInfos; } From 157ca8b2a44d27e4f10f8330d302a4bbcd3b4118 Mon Sep 17 00:00:00 2001 From: Ethan Yang Date: Sun, 8 Jul 2018 11:47:39 -0700 Subject: [PATCH 057/304] Change osu key bindings --- osu.Game.Rulesets.Osu/OsuRuleset.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index ce80537b93..b8ba1e2945 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -31,8 +31,8 @@ namespace osu.Game.Rulesets.Osu public override IEnumerable GetDefaultKeyBindings(int variant = 0) => new[] { - new KeyBinding(InputKey.Z, OsuAction.LeftButton), - new KeyBinding(InputKey.X, OsuAction.RightButton), + new KeyBinding(InputKey.A, OsuAction.LeftButton), + new KeyBinding(InputKey.S, OsuAction.RightButton), new KeyBinding(InputKey.MouseLeft, OsuAction.LeftButton), new KeyBinding(InputKey.MouseRight, OsuAction.RightButton), }; From b20afb915db429e0e3c2463d88e19d98c52e9684 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 9 Jul 2018 15:26:22 +0900 Subject: [PATCH 058/304] Fix right mouse activated absolute scroll not working --- osu.Game/OsuGameBase.cs | 30 ++++++++++++++++++++++++++++++ osu.Game/osu.Game.csproj | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 246229a794..c1d5ae581e 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -20,6 +20,7 @@ using osu.Game.Graphics.Cursor; using osu.Game.Online.API; using osu.Framework.Graphics.Performance; using osu.Framework.Graphics.Textures; +using osu.Framework.Input; using osu.Framework.Logging; using osu.Game.Audio; using osu.Game.Database; @@ -30,6 +31,7 @@ using osu.Game.IO; using osu.Game.Rulesets; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; +using OpenTK.Input; using DebugUtils = osu.Game.Utils.DebugUtils; namespace osu.Game @@ -98,6 +100,8 @@ namespace osu.Game private DatabaseContextFactory contextFactory; + protected override UserInputManager CreateUserInputManager() => new OsuUserInputManager(); + [BackgroundDependencyLoader] private void load() { @@ -267,5 +271,31 @@ namespace osu.Game return copy; } } + + private class OsuUserInputManager : UserInputManager + { + protected override MouseButtonEventManager CreateButtonManagerFor(MouseButton button) + { + switch (button) + { + case MouseButton.Right: + return new RightMouseManager(button); + } + + return base.CreateButtonManagerFor(button); + } + + private class RightMouseManager : MouseButtonEventManager + { + public RightMouseManager(MouseButton button) + : base(button) + { + } + + public override bool EnableDrag => true; // allow right-mouse dragging for absolute scroll in scroll containers. + public override bool EnableClick => false; + public override bool ChangeFocusOnClick => false; + } + } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index da55726447..cac3459412 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 0a67e5a274676b0bbb7146ce9c4b1fda24ec7c49 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 9 Jul 2018 17:09:17 +0900 Subject: [PATCH 059/304] Fix some possible null reference exceptions --- osu.Game/Screens/Select/Leaderboards/DrawableRank.cs | 4 +++- osu.Game/Users/Country.cs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs index 2a11bf8346..228633a41f 100644 --- a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs +++ b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs @@ -46,7 +46,9 @@ namespace osu.Game.Screens.Select.Leaderboards public void UpdateRank(ScoreRank newRank) { Rank = newRank; - updateTexture(); + + if (IsLoaded) + updateTexture(); } } } diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index c9b577a62f..98b3a2df0c 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -42,7 +42,9 @@ namespace osu.Game.Users return; country = value; - sprite.Texture = getFlagTexture(); + + if (IsLoaded) + sprite.Texture = getFlagTexture(); } } From 930667d0f9046ac16bae01598a7262a4236adf2b Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Mon, 9 Jul 2018 10:12:10 +0200 Subject: [PATCH 060/304] Remove unused age display code --- osu.Game/Overlays/Profile/ProfileHeader.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index c72ff6131b..c5510d3d70 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -360,11 +360,6 @@ namespace osu.Game.Overlays.Profile Text = text }; - if (user.Age != null) - { - infoTextLeft.AddText($"{user.Age} years old ", boldItalic); - } - if (user.Country != null) { infoTextLeft.AddText("From ", lightText); From 10aae3b0eead50a05be15cfb2e218ffc9a5ac4be Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Mon, 9 Jul 2018 10:33:46 +0200 Subject: [PATCH 061/304] Remove age from User class --- osu.Game.Tests/Visual/TestCaseUserProfile.cs | 1 - osu.Game/Users/User.cs | 3 --- 2 files changed, 4 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseUserProfile.cs b/osu.Game.Tests/Visual/TestCaseUserProfile.cs index aca832110a..cb281d045b 100644 --- a/osu.Game.Tests/Visual/TestCaseUserProfile.cs +++ b/osu.Game.Tests/Visual/TestCaseUserProfile.cs @@ -53,7 +53,6 @@ namespace osu.Game.Tests.Visual CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg", JoinDate = DateTimeOffset.Now.AddDays(-1), LastVisit = DateTimeOffset.Now, - Age = 1, ProfileOrder = new[] { "me" }, Statistics = new UserStatistics { diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index e1f68e1ce8..f42df4023f 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -23,9 +23,6 @@ namespace osu.Game.Users public Bindable Status = new Bindable(); - [JsonProperty(@"age")] - public int? Age; - //public Team Team; [JsonProperty(@"profile_colour")] From df67c0498de51314d30cdbeeeb4741bc92c7f302 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 9 Jul 2018 17:53:39 +0900 Subject: [PATCH 062/304] Fix OSD fade-in not correctly debouncing It could potentially never fade in on quick presses. --- .../Visual/TestCaseOnScreenDisplay.cs | 2 +- osu.Game/Overlays/OnScreenDisplay.cs | 38 +++++++++++++------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseOnScreenDisplay.cs b/osu.Game.Tests/Visual/TestCaseOnScreenDisplay.cs index 123c1fe055..bc232d814d 100644 --- a/osu.Game.Tests/Visual/TestCaseOnScreenDisplay.cs +++ b/osu.Game.Tests/Visual/TestCaseOnScreenDisplay.cs @@ -88,7 +88,7 @@ namespace osu.Game.Tests.Visual private class TestOnScreenDisplay : OnScreenDisplay { - protected override void Display(Drawable toDisplay) => toDisplay.FadeIn().ResizeHeightTo(110); + protected override void DisplayTemporarily(Drawable toDisplay) => toDisplay.FadeIn().ResizeHeightTo(110); } } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 1c80f2e626..753cd33cc6 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -14,6 +14,8 @@ using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics.Transforms; +using osu.Framework.Threading; using osu.Game.Configuration; using osu.Game.Graphics.Sprites; @@ -135,7 +137,7 @@ namespace osu.Game.Overlays /// If is already being tracked from the same . public void BeginTracking(object source, ITrackableConfigManager configManager) { - if (configManager == null) throw new ArgumentNullException(nameof(configManager)); + if (configManager == null) throw new ArgumentNullException(nameof(configManager)); if (trackedConfigManagers.ContainsKey((source, configManager))) throw new InvalidOperationException($"{nameof(configManager)} is already registered."); @@ -159,7 +161,7 @@ namespace osu.Game.Overlays /// If is not being tracked from the same . public void StopTracking(object source, ITrackableConfigManager configManager) { - if (configManager == null) throw new ArgumentNullException(nameof(configManager)); + if (configManager == null) throw new ArgumentNullException(nameof(configManager)); if (!trackedConfigManagers.TryGetValue((source, configManager), out var existing)) throw new InvalidOperationException($"{nameof(configManager)} is not registered."); @@ -181,7 +183,7 @@ namespace osu.Game.Overlays if (string.IsNullOrEmpty(textLine3.Text)) textLine3.Text = "NO KEY BOUND"; - Display(box); + DisplayTemporarily(box); int optionCount = 0; int selectedOption = -1; @@ -213,15 +215,29 @@ namespace osu.Game.Overlays }); } - protected virtual void Display(Drawable toDisplay) + private TransformSequence fadeIn; + private ScheduledDelegate fadeOut; + + protected virtual void DisplayTemporarily(Drawable toDisplay) { - toDisplay.Animate( - b => b.FadeIn(500, Easing.OutQuint), - b => b.ResizeHeightTo(height, 500, Easing.OutQuint) - ).Then( - b => b.FadeOutFromOne(1500, Easing.InQuint), - b => b.ResizeHeightTo(height_contracted, 1500, Easing.InQuint) - ); + // avoid starting a new fade-in if one is already active. + if (fadeIn == null) + { + fadeIn = toDisplay.Animate( + b => b.FadeIn(500, Easing.OutQuint), + b => b.ResizeHeightTo(height, 500, Easing.OutQuint) + ); + + fadeIn.Finally(_ => fadeIn = null); + } + + fadeOut?.Cancel(); + fadeOut = Scheduler.AddDelayed(() => + { + toDisplay.Animate( + b => b.FadeOutFromOne(1500, Easing.InQuint), + b => b.ResizeHeightTo(height_contracted, 1500, Easing.InQuint)); + }, 500); } private class OptionLight : Container From 09b3375a9d157ac4380f0f4308cd9e2f43a7d8fb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 9 Jul 2018 18:12:23 +0900 Subject: [PATCH 063/304] Fix pressing escape too fast causing multiple exit attempts at song select --- osu.Game/Screens/Select/SongSelect.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 9c62f92311..1d051a159e 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -138,7 +138,11 @@ namespace osu.Game.Screens.Select Height = filter_height, FilterChanged = c => Carousel.Filter(c), Background = { Width = 2 }, - Exit = Exit, + Exit = () => + { + if (IsCurrentScreen) + Exit(); + }, }, } }, From 49e94850b62b552bbb598cb509ea8b7f05357788 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 9 Jul 2018 18:43:20 +0900 Subject: [PATCH 064/304] Fix being able to trigger player before carousel is ready Causes an eventual crash. --- osu.Game/Screens/Select/SongSelect.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 9c62f92311..6b0f9d83cf 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -231,6 +231,10 @@ namespace osu.Game.Screens.Select /// Whether to trigger . public void FinaliseSelection(BeatmapInfo beatmap = null, bool performStartAction = true) { + // avoid attempting to continue before a selection has been obtained. + // this could happen via a user interaction while the carousel is still in a loading state. + if (Carousel.SelectedBeatmap == null) return; + // if we have a pending filter operation, we want to run it now. // it could change selection (ie. if the ruleset has been changed). Carousel.FlushPendingFilterOperations(); From abfebbddd9c666a7fe3b973b0dc6efb8c571b09d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 9 Jul 2018 23:50:45 +0900 Subject: [PATCH 065/304] 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 da55726447..ec2742d4a9 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 974c4f5185f98bee0a1b61cf6f79c137d8de6882 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 Jul 2018 01:20:21 +0900 Subject: [PATCH 066/304] ToolbarMode* -> ToolbarRuleset* --- osu.Game.Tests/Visual/TestCaseToolbar.cs | 4 ++-- osu.Game/Overlays/Toolbar/Toolbar.cs | 2 +- .../{ToolbarModeButton.cs => ToolbarRulesetButton.cs} | 2 +- ...oolbarModeSelector.cs => ToolbarRulesetSelector.cs} | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) rename osu.Game/Overlays/Toolbar/{ToolbarModeButton.cs => ToolbarRulesetButton.cs} (96%) rename osu.Game/Overlays/Toolbar/{ToolbarModeSelector.cs => ToolbarRulesetSelector.cs} (93%) diff --git a/osu.Game.Tests/Visual/TestCaseToolbar.cs b/osu.Game.Tests/Visual/TestCaseToolbar.cs index fd218af054..96f14e6b32 100644 --- a/osu.Game.Tests/Visual/TestCaseToolbar.cs +++ b/osu.Game.Tests/Visual/TestCaseToolbar.cs @@ -16,8 +16,8 @@ namespace osu.Game.Tests.Visual public override IReadOnlyList RequiredTypes => new[] { typeof(ToolbarButton), - typeof(ToolbarModeSelector), - typeof(ToolbarModeButton), + typeof(ToolbarRulesetSelector), + typeof(ToolbarRulesetButton), typeof(ToolbarNotificationButton), }; diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 48d0674b3d..eeace2f11c 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -50,7 +50,7 @@ namespace osu.Game.Overlays.Toolbar { Action = () => OnHome?.Invoke() }, - new ToolbarModeSelector() + new ToolbarRulesetSelector() } }, new FillFlowContainer diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs similarity index 96% rename from osu.Game/Overlays/Toolbar/ToolbarModeButton.cs rename to osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs index 90b9abb2e4..bbdf796e7a 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs @@ -7,7 +7,7 @@ using OpenTK.Graphics; namespace osu.Game.Overlays.Toolbar { - public class ToolbarModeButton : ToolbarButton + public class ToolbarRulesetButton : ToolbarButton { private RulesetInfo ruleset; public RulesetInfo Ruleset diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs similarity index 93% rename from osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs rename to osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index dae4f84b1a..b1af3f0d62 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -16,18 +16,18 @@ using osu.Game.Rulesets; namespace osu.Game.Overlays.Toolbar { - public class ToolbarModeSelector : Container + public class ToolbarRulesetSelector : Container { private const float padding = 10; private readonly FillFlowContainer modeButtons; private readonly Drawable modeButtonLine; - private ToolbarModeButton activeButton; + private ToolbarRulesetButton activeButton; private RulesetStore rulesets; private readonly Bindable ruleset = new Bindable(); - public ToolbarModeSelector() + public ToolbarRulesetSelector() { RelativeSizeAxes = Axes.Y; @@ -73,7 +73,7 @@ namespace osu.Game.Overlays.Toolbar this.rulesets = rulesets; foreach (var r in rulesets.AvailableRulesets) { - modeButtons.Add(new ToolbarModeButton + modeButtons.Add(new ToolbarRulesetButton { Ruleset = r, Action = delegate { ruleset.Value = r; } @@ -115,7 +115,7 @@ namespace osu.Game.Overlays.Toolbar private void rulesetChanged(RulesetInfo ruleset) { - foreach (ToolbarModeButton m in modeButtons.Children.Cast()) + foreach (ToolbarRulesetButton m in modeButtons.Children.Cast()) { bool isActive = m.Ruleset.ID == ruleset.ID; m.Active = isActive; From 9e59b4a8e2122f6ed824795f546bbe6cc86703a4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 Jul 2018 01:29:24 +0900 Subject: [PATCH 067/304] Fix SongSelect binding to ruleset too early Causes music to stop playing while at main menu. --- osu.Game/Screens/Select/SongSelect.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 85eecd5c1a..81502fc024 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -193,8 +193,6 @@ namespace osu.Game.Screens.Select dependencies.CacheAs(Ruleset); dependencies.CacheAs>(Ruleset); - base.Ruleset.ValueChanged += r => updateSelectedBeatmap(beatmapNoDebounce); - if (Footer != null) { Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2); @@ -222,6 +220,12 @@ namespace osu.Game.Screens.Select Beatmap.BindValueChanged(workingBeatmapChanged); } + protected override void LoadComplete() + { + base.LoadComplete(); + base.Ruleset.ValueChanged += r => updateSelectedBeatmap(beatmapNoDebounce); + } + public void Edit(BeatmapInfo beatmap) { Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value); From ba258b8a054398a1a860220db453301245b064b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 Jul 2018 02:56:00 +0900 Subject: [PATCH 068/304] Fix lack of fallback logic for custom bank samples Closes #2966. --- Was causing some beatmaps to not play all of their hitsounds --- osu.Game/Audio/SampleInfo.cs | 13 ++++++++++++- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 7e329ac651..9ed40c648e 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -29,6 +29,11 @@ namespace osu.Game.Audio /// public string Name; + /// + /// An optional suffix to provide priority lookup. Falls back to non-suffixed . + /// + public string Suffix; + /// /// The sample volume. /// @@ -41,9 +46,15 @@ namespace osu.Game.Audio { get { + if (!string.IsNullOrEmpty(Suffix)) + { + if (!string.IsNullOrEmpty(Namespace)) + yield return $"{Namespace}/{Bank}-{Name}{Suffix}"; + yield return $"{Bank}-{Name}{Suffix}"; // Without namespace as a fallback even when we have a namespace + } + if (!string.IsNullOrEmpty(Namespace)) yield return $"{Namespace}/{Bank}-{Name}"; - yield return $"{Bank}-{Name}"; // Without namespace as a fallback even when we have a namespace } } diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 22a6acf459..c8874c3bc7 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -179,7 +179,7 @@ namespace osu.Game.Beatmaps.Formats var baseInfo = base.ApplyTo(sampleInfo); if (CustomSampleBank > 1) - baseInfo.Name += CustomSampleBank; + baseInfo.Suffix = CustomSampleBank.ToString(); return baseInfo; } From 7f315d79c27cea08e07a8c321cb69094232ab19e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 Jul 2018 13:06:03 +0900 Subject: [PATCH 069/304] Fix pixel gap in user profile when scrolling --- osu.Game/Overlays/Profile/ProfileHeader.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index c5510d3d70..9d09836d25 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -158,6 +158,13 @@ namespace osu.Game.Overlays.Profile } } }, + new Box // this is a temporary workaround for incorrect masking behaviour of FillMode.Fill used in UserCoverBackground (see https://github.com/ppy/osu-framework/issues/1675) + { + RelativeSizeAxes = Axes.X, + Height = 1, + Y = cover_height, + Colour = OsuColour.Gray(34), + }, infoTextLeft = new LinkFlowContainer(t => t.TextSize = 14) { X = UserProfileOverlay.CONTENT_X_MARGIN, From 14c3cc70b15da9a3ac20cb25c37e704a8536dc61 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 Jul 2018 15:23:47 +0900 Subject: [PATCH 070/304] Prefer namespace lookups first --- osu.Game/Audio/SampleInfo.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 9ed40c648e..4345d09e05 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -46,16 +46,17 @@ namespace osu.Game.Audio { get { - if (!string.IsNullOrEmpty(Suffix)) + if (!string.IsNullOrEmpty(Namespace)) { - if (!string.IsNullOrEmpty(Namespace)) + if (!string.IsNullOrEmpty(Suffix)) yield return $"{Namespace}/{Bank}-{Name}{Suffix}"; - yield return $"{Bank}-{Name}{Suffix}"; // Without namespace as a fallback even when we have a namespace + yield return $"{Namespace}/{Bank}-{Name}"; } - if (!string.IsNullOrEmpty(Namespace)) - yield return $"{Namespace}/{Bank}-{Name}"; - yield return $"{Bank}-{Name}"; // Without namespace as a fallback even when we have a namespace + // check non-namespace as a fallback even when we have a namespace + if (!string.IsNullOrEmpty(Suffix)) + yield return $"{Bank}-{Name}{Suffix}"; + yield return $"{Bank}-{Name}"; } } From bf1ce8cdd8895f618437ca39857609bc15871f84 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 10 Jul 2018 16:02:13 +0900 Subject: [PATCH 071/304] Fix linking still being broken --- osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs index eaa0ac4aaa..1a1f13933d 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Profile.Sections Action = () => { if (beatmap.OnlineBeatmapID != null) - beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.OnlineBeatmapID.Value); + beatmapSetOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value); else if (beatmap.BeatmapSet?.OnlineBeatmapSetID != null) beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.BeatmapSet.OnlineBeatmapSetID.Value); }; From ab155e511f88db6dd25e565d85f9a40269cad196 Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Tue, 10 Jul 2018 16:09:18 +0900 Subject: [PATCH 072/304] Remove commented disable-once --- osu.Game/Graphics/SpriteIcon.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index 45c4cebfcf..6acd20719e 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -10,7 +10,6 @@ using osu.Framework.IO.Stores; using OpenTK; using OpenTK.Graphics; using osu.Framework.Caching; -// ReSharper disable IdentifierTypo namespace osu.Game.Graphics { From 65d351c31a7494c1103e92a2425a24310d482d01 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 10 Jul 2018 16:26:04 +0900 Subject: [PATCH 073/304] Fix failing test cases --- .../Beatmaps/Formats/LegacyBeatmapDecoderTest.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index ad203d2107..2f5b4a13d9 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -222,10 +222,10 @@ namespace osu.Game.Tests.Beatmaps.Formats { var hitObjects = decoder.Decode(stream).HitObjects; - Assert.AreEqual("hitnormal", getTestableSampleInfo(hitObjects[0]).Name); - Assert.AreEqual("hitnormal", getTestableSampleInfo(hitObjects[1]).Name); - Assert.AreEqual("hitnormal2", getTestableSampleInfo(hitObjects[2]).Name); - Assert.AreEqual("hitnormal", getTestableSampleInfo(hitObjects[3]).Name); + Assert.AreEqual("normal-hitnormal", getTestableSampleInfo(hitObjects[0]).LookupNames.First()); + Assert.AreEqual("normal-hitnormal", getTestableSampleInfo(hitObjects[1]).LookupNames.First()); + Assert.AreEqual("normal-hitnormal2", getTestableSampleInfo(hitObjects[2]).LookupNames.First()); + Assert.AreEqual("normal-hitnormal", getTestableSampleInfo(hitObjects[3]).LookupNames.First()); } SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(new SampleInfo { Name = "hitnormal" }); @@ -242,7 +242,7 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.AreEqual("hit_1.wav", hitObjects[0].Samples[0].LookupNames.First()); Assert.AreEqual("hit_2.wav", hitObjects[1].Samples[0].LookupNames.First()); - Assert.AreEqual("hitnormal2", getTestableSampleInfo(hitObjects[2]).Name); + Assert.AreEqual("normal-hitnormal2", getTestableSampleInfo(hitObjects[2]).LookupNames.First()); Assert.AreEqual("hit_1.wav", hitObjects[3].Samples[0].LookupNames.First()); } From 2150cb10283ad38604c9b67aa6b3abcad6568aeb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 Jul 2018 20:30:08 +0900 Subject: [PATCH 074/304] Update framework and other packages --- osu.Desktop/Program.cs | 6 ++---- osu.Game/osu.Game.csproj | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 780a9994fd..7e6a07c89f 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -7,6 +7,7 @@ using System.Linq; using osu.Framework; using osu.Framework.Platform; using osu.Game.IPC; + #if NET_FRAMEWORK using System.Runtime; #endif @@ -18,10 +19,7 @@ namespace osu.Desktop [STAThread] public static int Main(string[] args) { - // required to initialise native SQLite libraries on some platforms. - - if (!RuntimeInfo.IsMono) - useMultiCoreJit(); + useMultiCoreJit(); // Back up the cwd before DesktopGameHost changes it var cwd = Environment.CurrentDirectory; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index ec2742d4a9..f7c8c62e91 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -14,11 +14,11 @@ - + - + From dd20663192abde634e45437ec39a3c749fb95266 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 10 Jul 2018 17:28:56 +0200 Subject: [PATCH 075/304] Lesser keyboard steps --- .../Overlays/Settings/Sections/Audio/OffsetSettings.cs | 2 +- .../Overlays/Settings/Sections/Audio/VolumeSettings.cs | 8 ++++---- .../Settings/Sections/Gameplay/GeneralSettings.cs | 4 ++-- .../Settings/Sections/Gameplay/SongSelectSettings.cs | 4 ++-- .../Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 4 ++-- osu.Game/Overlays/Settings/Sections/SkinSection.cs | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs index 8850f716e0..0fe41327db 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio { LabelText = "Audio Offset", Bindable = config.GetBindable(OsuSetting.AudioOffset), - KeyboardStep = 100f + KeyboardStep = 1f }, new SettingsButton { diff --git a/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs index 80896c163f..369c751448 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs @@ -17,10 +17,10 @@ namespace osu.Game.Overlays.Settings.Sections.Audio { Children = new Drawable[] { - new SettingsSlider { LabelText = "Master", Bindable = audio.Volume, KeyboardStep = 0.1f }, - new SettingsSlider { LabelText = "Master (Window Inactive)", Bindable = config.GetBindable(OsuSetting.VolumeInactive), KeyboardStep = 0.1f }, - new SettingsSlider { LabelText = "Effect", Bindable = audio.VolumeSample, KeyboardStep = 0.1f }, - new SettingsSlider { LabelText = "Music", Bindable = audio.VolumeTrack, KeyboardStep = 0.1f }, + new SettingsSlider { LabelText = "Master", Bindable = audio.Volume, KeyboardStep = 0.01f }, + new SettingsSlider { LabelText = "Master (Window Inactive)", Bindable = config.GetBindable(OsuSetting.VolumeInactive), KeyboardStep = 0.01f }, + new SettingsSlider { LabelText = "Effect", Bindable = audio.VolumeSample, KeyboardStep = 0.01f }, + new SettingsSlider { LabelText = "Music", Bindable = audio.VolumeTrack, KeyboardStep = 0.01f }, }; } } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs index 9c8f5e2643..21d5d452bf 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs @@ -21,13 +21,13 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { LabelText = "Background dim", Bindable = config.GetBindable(OsuSetting.DimLevel), - KeyboardStep = 0.1f + KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Background blur", Bindable = config.GetBindable(OsuSetting.BlurLevel), - KeyboardStep = 0.1f + KeyboardStep = 0.01f }, new SettingsCheckbox { diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs index 7893d76fb8..235ff0f319 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs @@ -31,13 +31,13 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { LabelText = "Display beatmaps from", Bindable = config.GetBindable(OsuSetting.DisplayStarsMinimum), - KeyboardStep = 1f + KeyboardStep = 0.1f }, new SettingsSlider { LabelText = "up to", Bindable = config.GetBindable(OsuSetting.DisplayStarsMaximum), - KeyboardStep = 1f + KeyboardStep = 0.1f }, new SettingsEnumDropdown { diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 1f87a635de..42028f6bd5 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -50,13 +50,13 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { LabelText = "Horizontal position", Bindable = config.GetBindable(FrameworkSetting.LetterboxPositionX), - KeyboardStep = 0.1f + KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Vertical position", Bindable = config.GetBindable(FrameworkSetting.LetterboxPositionY), - KeyboardStep = 0.1f + KeyboardStep = 0.01f }, } }, diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index 18a371e904..df8ebaf4aa 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -36,13 +36,13 @@ namespace osu.Game.Overlays.Settings.Sections { LabelText = "Menu cursor size", Bindable = config.GetBindable(OsuSetting.MenuCursorSize), - KeyboardStep = 0.1f + KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Gameplay cursor size", Bindable = config.GetBindable(OsuSetting.GameplayCursorSize), - KeyboardStep = 0.1f + KeyboardStep = 0.01f }, new SettingsCheckbox { From 1418d1369fe76c5e76a0cfaeda57b331334d090f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 01:32:10 +0900 Subject: [PATCH 076/304] Add the ability to click completed download notifications to select beatmap Closes #2731. --- osu.Game/Beatmaps/BeatmapManager.cs | 15 ++++++++++++++- osu.Game/OsuGame.cs | 27 +++++++++++++++++++++++++++ osu.Game/Screens/Menu/MainMenu.cs | 6 +++++- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index fd24e4297b..e63f70610e 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -45,6 +45,11 @@ namespace osu.Game.Beatmaps /// public event Action BeatmapDownloadBegan; + /// + /// Fired when a beatmap load is requested (into the interactive game UI). + /// + public Action PresentBeatmap; + /// /// A default representation of a WorkingBeatmap to use when no beatmap is available. /// @@ -163,12 +168,20 @@ namespace osu.Game.Beatmaps Task.Factory.StartNew(() => { + BeatmapSetInfo importedBeatmap; + // This gets scheduled back to the update thread, but we want the import to run in the background. using (var stream = new MemoryStream(data)) using (var archive = new ZipArchiveReader(stream, beatmapSetInfo.ToString())) - Import(archive); + importedBeatmap = Import(archive); + downloadNotification.CompletionClickAction = () => + { + PresentBeatmap?.Invoke(importedBeatmap); + return true; + }; downloadNotification.State = ProgressNotificationState.Completed; + currentDownloads.Remove(request); }, TaskCreationOptions.LongRunning); }; diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 922d228701..f8fdaf368c 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -23,6 +23,7 @@ using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Platform; using osu.Framework.Threading; +using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Rulesets.Scoring; using osu.Game.Overlays.Notifications; @@ -33,6 +34,7 @@ using osu.Game.Rulesets.Mods; using osu.Game.Skinning; using OpenTK.Graphics; using osu.Game.Overlays.Volume; +using osu.Game.Screens.Select; namespace osu.Game { @@ -178,6 +180,30 @@ namespace osu.Game /// The set to display. public void ShowBeatmapSet(int setId) => beatmapSetOverlay.FetchAndShowBeatmapSet(setId); + /// + /// Present a beatmap at song select. + /// + /// The beatmap to select. + public void PresentBeatmap(BeatmapSetInfo beatmap) + { + CloseAllOverlays(); + + Beatmap.Value = BeatmapManager.GetWorkingBeatmap(beatmap.Beatmaps.First()); + + switch (currentScreen) + { + case SongSelect _: + break; + default: + // navigate to song select if we are not already there. + var menu = (MainMenu)intro.ChildScreen; + + menu.MakeCurrent(); + menu.LoadToSolo(); + break; + } + } + /// /// Show a user's profile as an overlay. /// @@ -244,6 +270,7 @@ namespace osu.Game BeatmapManager.PostNotification = n => notifications?.Post(n); BeatmapManager.GetStableStorage = GetStorageForStableInstall; + BeatmapManager.PresentBeatmap = PresentBeatmap; AddRange(new Drawable[] { diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index d922f49ce3..4790996833 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Menu OnChart = delegate { Push(new ChartListing()); }, OnDirect = delegate { Push(new OnlineListing()); }, OnEdit = delegate { Push(new Editor()); }, - OnSolo = delegate { Push(consumeSongSelect()); }, + OnSolo = onSolo, OnMulti = delegate { Push(new Multiplayer()); }, OnExit = Exit, } @@ -85,6 +85,10 @@ namespace osu.Game.Screens.Menu LoadComponentAsync(songSelect = new PlaySongSelect()); } + public void LoadToSolo() => Schedule(onSolo); + + private void onSolo() => Push(consumeSongSelect()); + private Screen consumeSongSelect() { var s = songSelect; From 7157428882545b367e4bc975556a9361a620e735 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 02:59:00 +0900 Subject: [PATCH 077/304] Fix import failure of beatmap sets containing duplicate beatmap difficulties --- osu.Game/Beatmaps/BeatmapManager.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index fd24e4297b..fc4d43080e 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -92,7 +92,7 @@ namespace osu.Game.Beatmaps // by setting the model here, we can update the noline set id below. b.BeatmapSet = model; - fetchAndPopulateOnlineIDs(b); + fetchAndPopulateOnlineIDs(b, model.Beatmaps); } // check if a set already exists with the same online id, delete if it does. @@ -396,9 +396,10 @@ namespace osu.Game.Beatmaps /// Query the API to populate mising OnlineBeatmapID / OnlineBeatmapSetID properties. /// /// The beatmap to populate. + /// The other beatmaps contained within this set. /// Whether to re-query if the provided beatmap already has populated values. /// True if population was successful. - private bool fetchAndPopulateOnlineIDs(BeatmapInfo beatmap, bool force = false) + private bool fetchAndPopulateOnlineIDs(BeatmapInfo beatmap, IEnumerable otherBeatmaps, bool force = false) { if (!force && beatmap.OnlineBeatmapID != null && beatmap.BeatmapSet.OnlineBeatmapSetID != null) return true; @@ -418,6 +419,12 @@ namespace osu.Game.Beatmaps Logger.Log($"Successfully mapped to {res.OnlineBeatmapSetID} / {res.OnlineBeatmapID}.", LoggingTarget.Database); + if (otherBeatmaps.Any(b => b.OnlineBeatmapID == res.OnlineBeatmapID)) + { + Logger.Log("Another beatmap in the same set already mapped to this ID. We'll skip adding it this time.", LoggingTarget.Database); + return false; + } + beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID; beatmap.OnlineBeatmapID = res.OnlineBeatmapID; return true; From 55e0cd770d5c8451634ff461b402d29546cb4054 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Wed, 11 Jul 2018 11:24:43 +0900 Subject: [PATCH 078/304] Use BypassAutoSizeAxes --- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index 5d4d627995..d407dc9cf9 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -102,6 +102,7 @@ namespace osu.Game.Overlays.KeyBinding RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Margin = new MarginPadding(padding), + Padding = new MarginPadding { Top = height }, Alpha = 0, Colour = colours.YellowDark } @@ -267,7 +268,7 @@ namespace osu.Game.Overlays.KeyBinding GetContainingInputManager().ChangeFocus(null); pressAKey.FadeOut(300, Easing.OutQuint); - pressAKey.Padding = new MarginPadding { Top = height, Bottom = -pressAKey.DrawHeight }; + pressAKey.BypassAutoSizeAxes |= Axes.Y; } protected override void OnFocus(InputState state) @@ -276,7 +277,7 @@ namespace osu.Game.Overlays.KeyBinding AutoSizeEasing = Easing.OutQuint; pressAKey.FadeIn(300, Easing.OutQuint); - pressAKey.Padding = new MarginPadding { Top = height }; + pressAKey.BypassAutoSizeAxes &= ~Axes.Y; updateBindTarget(); base.OnFocus(state); From 5615a32953065870204f9dff6c2ed4a6739ca158 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 14:53:40 +0900 Subject: [PATCH 079/304] Fix mac installer extension being incorrect --- osu.Desktop/Updater/SimpleUpdateManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/Updater/SimpleUpdateManager.cs b/osu.Desktop/Updater/SimpleUpdateManager.cs index cda8e6a7ca..6c363422f7 100644 --- a/osu.Desktop/Updater/SimpleUpdateManager.cs +++ b/osu.Desktop/Updater/SimpleUpdateManager.cs @@ -72,7 +72,7 @@ namespace osu.Desktop.Updater bestAsset = release.Assets?.FirstOrDefault(f => f.Name.EndsWith(".exe")); break; case RuntimeInfo.Platform.MacOsx: - bestAsset = release.Assets?.FirstOrDefault(f => f.Name.EndsWith(".dmg")); + bestAsset = release.Assets?.FirstOrDefault(f => f.Name.EndsWith(".app.zip")); break; } From 8bc7c4c9a262057013a14cb4f05c1fc81f64e8c5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 16:30:33 +0900 Subject: [PATCH 080/304] Add TestCase and update disclaimer screen --- osu.Game.Tests/Visual/TestCaseDisclaimer.cs | 28 +++++ osu.Game/Screens/Menu/Disclaimer.cs | 120 +++++++++----------- 2 files changed, 84 insertions(+), 64 deletions(-) create mode 100644 osu.Game.Tests/Visual/TestCaseDisclaimer.cs diff --git a/osu.Game.Tests/Visual/TestCaseDisclaimer.cs b/osu.Game.Tests/Visual/TestCaseDisclaimer.cs new file mode 100644 index 0000000000..a8253a991a --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseDisclaimer.cs @@ -0,0 +1,28 @@ +// 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.Framework.Graphics.Shapes; +using osu.Game.Screens.Menu; +using OpenTK.Graphics; + +namespace osu.Game.Tests.Visual +{ + public class TestCaseDisclaimer : OsuTestCase + { + [BackgroundDependencyLoader] + private void load() + { + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + }, + new Disclaimer() + }; + } + } +} diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 0c70dbf570..694f911773 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -3,10 +3,9 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Screens; using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.Containers; using OpenTK; using OpenTK.Graphics; using osu.Game.Overlays; @@ -16,96 +15,89 @@ namespace osu.Game.Screens.Menu public class Disclaimer : OsuScreen { private Intro intro; - private readonly SpriteIcon icon; + private SpriteIcon icon; private Color4 iconColour; + private LinkFlowContainer textFlow; protected override bool HideOverlaysOnEnter => true; protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled; public override bool CursorVisible => false; + private const float icon_y = -0.09f; + public Disclaimer() { ValidForResume = false; - - Children = new Drawable[] - { - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 2), - Children = new Drawable[] - { - icon = new SpriteIcon - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Icon = FontAwesome.fa_warning, - Size = new Vector2(30), - }, - new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - TextSize = 30, - Text = "This is a development build", - Margin = new MarginPadding - { - Bottom = 20 - }, - }, - new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Text = "Don't expect shit to work perfectly as this is very much a work in progress." - }, - new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Text = "Don't report bugs because we are aware. Don't complain about missing features because we are adding them." - }, - new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Text = "Sit back and enjoy. Visit discord.gg/ppy if you want to help out!", - Margin = new MarginPadding { Bottom = 20 }, - }, - new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - TextSize = 12, - Text = "oh and yes, you will get seizures.", - }, - } - } - }; } [BackgroundDependencyLoader] private void load(OsuColour colours) { - LoadComponentAsync(intro = new Intro()); + Children = new Drawable[] + { + icon = new SpriteIcon + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Icon = FontAwesome.fa_warning, + Size = new Vector2(30), + RelativePositionAxes = Axes.Both, + Y = icon_y, + }, + textFlow = new LinkFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding(50), + TextAnchor = Anchor.TopCentre, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Spacing = new Vector2(0, 2), + } + }; + + textFlow.AddText("This is an ", t => + { + t.TextSize = 30; + t.Font = @"Exo2.0-Light"; + }); + textFlow.AddText("early development build", t => + { + t.TextSize = 30; + t.Font = @"Exo2.0-SemiBold"; + }); + + textFlow.AddParagraph("Don't expect everything to work perfectly."); + textFlow.AddParagraph(""); + textFlow.AddParagraph("Detailed bug reports are welcomed via github issues."); + textFlow.AddParagraph(""); + + textFlow.AddText("Visit "); + textFlow.AddLink("discord.gg/ppy", "https://discord.gg/ppy"); + textFlow.AddText(" if you want to help out or follow progress!"); iconColour = colours.Yellow; } + protected override void LoadComplete() + { + base.LoadComplete(); + LoadComponentAsync(intro = new Intro()); + } + protected override void OnEntering(Screen last) { base.OnEntering(last); - icon.Delay(1500).FadeColour(iconColour, 200); + icon.Delay(1500).FadeColour(iconColour, 200, Easing.OutQuint); + icon.Delay(1500).MoveToY(icon_y * 1.1f, 100, Easing.OutCirc).Then().MoveToY(icon_y, 100, Easing.InCirc); Content .FadeInFromZero(500) .Then(5500) .FadeOut(250) + .ScaleTo(0.9f, 250, Easing.InQuint) .Finally(d => Push(intro)); } } From 4638ac902c63c5501e69cb4ce1fdc3afdb533d5d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 16:30:16 +0900 Subject: [PATCH 081/304] Remove pointless rate adjust slider from TestCaseOsuGame --- osu.Game.Tests/Visual/TestCaseOsuGame.cs | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseOsuGame.cs b/osu.Game.Tests/Visual/TestCaseOsuGame.cs index f1a21a58d5..7a4e4c1210 100644 --- a/osu.Game.Tests/Visual/TestCaseOsuGame.cs +++ b/osu.Game.Tests/Visual/TestCaseOsuGame.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; -using osu.Framework.Timing; using osu.Game.Screens; using osu.Game.Screens.Menu; using OpenTK.Graphics; @@ -23,19 +22,15 @@ namespace osu.Game.Tests.Visual public TestCaseOsuGame() { - var rateAdjustClock = new StopwatchClock(true); - var framedClock = new FramedClock(rateAdjustClock); - framedClock.ProcessFrame(); - - Add(new Box + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - }); - - Add(new Loader()); - - AddSliderStep("Playback speed", 0.0, 2.0, 1, v => rateAdjustClock.Rate = v); + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + }, + new Loader() + }; } } } From fbc5250bf1ba54de25889fd534ba9f3b9d5c1a7d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 17:07:14 +0900 Subject: [PATCH 082/304] Update framework --- osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs | 4 ++-- osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs | 4 ++-- osu.Game.Rulesets.Mania/UI/Column.cs | 4 ++-- osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs | 4 ++-- osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs | 8 ++++---- .../Graphics/Containers/OsuFocusedOverlayContainer.cs | 4 ++-- osu.Game/OsuGame.cs | 4 ++-- osu.Game/OsuGameBase.cs | 4 ++-- osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs | 4 ++-- osu.Game/Rulesets/UI/RulesetContainer.cs | 4 ++-- osu.Game/Screens/Edit/Editor.cs | 4 ++-- osu.Game/Screens/Select/SongSelect.cs | 4 ++-- osu.Game/Screens/Tournament/Drawings.cs | 4 ++-- osu.Game/Skinning/LocalSkinOverrideContainer.cs | 4 ++-- osu.Game/Storyboards/Drawables/DrawableStoryboard.cs | 4 ++-- osu.Game/Tests/Visual/EditorClockTestCase.cs | 4 ++-- osu.Game/Tests/Visual/OsuTestCase.cs | 4 ++-- osu.Game/osu.Game.csproj | 2 +- 18 files changed, 37 insertions(+), 37 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs b/osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs index 78a98e83e8..5a93efb0dc 100644 --- a/osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs +++ b/osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs @@ -21,9 +21,9 @@ namespace osu.Game.Rulesets.Mania.Tests this.direction = direction; } - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs(new ScrollingInfo { Direction = { Value = direction }}); return dependencies; } diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs index e827fa1fdc..64ed08373a 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs @@ -137,9 +137,9 @@ namespace osu.Game.Rulesets.Mania.Tests }; } - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs>(new Bindable()); return dependencies; } diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index a19a6fb5d4..8465258055 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -118,9 +118,9 @@ namespace osu.Game.Rulesets.Mania.UI } } - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs>(Action); return dependencies; } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index e6ebf43c67..f1dff29a0c 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -80,9 +80,9 @@ namespace osu.Game.Rulesets.Mania.UI private DependencyContainer dependencies; - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs(scrollingInfo = new ScrollingInfo()); return dependencies; } diff --git a/osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs b/osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs index d711d501fe..e4cb848d90 100644 --- a/osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs +++ b/osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs @@ -14,9 +14,9 @@ namespace osu.Game.Tests.Visual { private readonly PreviewTrackManager trackManager = new TestPreviewTrackManager(); - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs(trackManager); dependencies.CacheAs(this); return dependencies; @@ -101,9 +101,9 @@ namespace osu.Game.Tests.Visual AddInternal(track); } - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs(this); return dependencies; } diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index d6bc4a2095..1d832d1c54 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -26,9 +26,9 @@ namespace osu.Game.Graphics.Containers protected readonly Bindable OverlayActivationMode = new Bindable(OverlayActivation.All); - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs(this); return dependencies; } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 922d228701..b654e5d53f 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -122,8 +122,8 @@ namespace osu.Game private DependencyContainer dependencies; - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => - dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => + dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); [BackgroundDependencyLoader] private void load(FrameworkConfigManager frameworkConfig) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index c1d5ae581e..a9b74d6740 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -95,8 +95,8 @@ namespace osu.Game private DependencyContainer dependencies; - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => - dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => + dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); private DatabaseContextFactory contextFactory; diff --git a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs index 05104018cd..191308cca6 100644 --- a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs @@ -21,9 +21,9 @@ namespace osu.Game.Overlays.Settings private DependencyContainer dependencies; - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); var config = dependencies.Get().GetConfigFor(ruleset); if (config != null) diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index fedb6abed3..71d7919dd4 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -85,9 +85,9 @@ namespace osu.Game.Rulesets.UI Cursor = CreateCursor(); } - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); onScreenDisplay = dependencies.Get(); diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 7eeabd3e5e..a52fa3b462 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -42,8 +42,8 @@ namespace osu.Game.Screens.Edit private DependencyContainer dependencies; private GameHost host; - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) - => dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); [BackgroundDependencyLoader] private void load(OsuColour colours, GameHost host) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 81502fc024..e6926c118b 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -69,8 +69,8 @@ namespace osu.Game.Screens.Select private DependencyContainer dependencies; - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) - => dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); protected SongSelect() { diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 29301899d5..49a46b96e3 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -49,8 +49,8 @@ namespace osu.Game.Screens.Tournament private DependencyContainer dependencies; - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => - dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => + dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); [BackgroundDependencyLoader] private void load(TextureStore textures, Storage storage) diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index ad6a033936..3adf287cf7 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -71,9 +71,9 @@ namespace osu.Game.Skinning private void onSourceChanged() => SourceChanged?.Invoke(); - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); fallbackSource = dependencies.Get(); dependencies.CacheAs(this); diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs index a2f4372323..d746bb90c4 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs @@ -36,8 +36,8 @@ namespace osu.Game.Storyboards.Drawables public override bool RemoveCompletedTransforms => false; private DependencyContainer dependencies; - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => - dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => + dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); public DrawableStoryboard(Storyboard storyboard) { diff --git a/osu.Game/Tests/Visual/EditorClockTestCase.cs b/osu.Game/Tests/Visual/EditorClockTestCase.cs index 521b51529e..22f3e5b6df 100644 --- a/osu.Game/Tests/Visual/EditorClockTestCase.cs +++ b/osu.Game/Tests/Visual/EditorClockTestCase.cs @@ -25,9 +25,9 @@ namespace osu.Game.Tests.Visual Clock = new EditorClock(new ControlPointInfo(), 5000, BeatDivisor) { IsCoupled = false }; } - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.Cache(BeatDivisor); dependencies.CacheAs(Clock); diff --git a/osu.Game/Tests/Visual/OsuTestCase.cs b/osu.Game/Tests/Visual/OsuTestCase.cs index 5f70055021..fcbab5b8f5 100644 --- a/osu.Game/Tests/Visual/OsuTestCase.cs +++ b/osu.Game/Tests/Visual/OsuTestCase.cs @@ -20,9 +20,9 @@ namespace osu.Game.Tests.Visual protected DependencyContainer Dependencies { get; private set; } - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - Dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + Dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); Dependencies.CacheAs(beatmap); Dependencies.CacheAs(beatmap); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f7c8c62e91..bfc7b21242 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 24054246b80def77001f1a55c5e0d498aaaaa632 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 17:25:57 +0900 Subject: [PATCH 083/304] Fix DI regression --- .../ManiaSettingsSubsection.cs | 4 ++-- .../UI/ManiaRulesetContainer.cs | 4 ++-- .../Settings/RulesetSettingsSubsection.cs | 9 ++++++--- osu.Game/Rulesets/UI/RulesetContainer.cs | 17 +++++++++-------- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs b/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs index 54a7bf954d..783142fadc 100644 --- a/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs +++ b/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs @@ -19,14 +19,14 @@ namespace osu.Game.Rulesets.Mania } [BackgroundDependencyLoader] - private void load(ManiaConfigManager config) + private void load() { Children = new Drawable[] { new SettingsEnumDropdown { LabelText = "Scrolling direction", - Bindable = config.GetBindable(ManiaSetting.ScrollDirection) + Bindable = ((ManiaConfigManager)Config).GetBindable(ManiaSetting.ScrollDirection) } }; } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index f1dff29a0c..abc9705119 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -70,11 +70,11 @@ namespace osu.Game.Rulesets.Mania.UI } [BackgroundDependencyLoader] - private void load(ManiaConfigManager config) + private void load() { BarLines.ForEach(Playfield.Add); - config.BindWith(ManiaSetting.ScrollDirection, configDirection); + ((ManiaConfigManager)Config).BindWith(ManiaSetting.ScrollDirection, configDirection); configDirection.BindValueChanged(d => scrollingInfo.Direction.Value = (ScrollingDirection)d, true); } diff --git a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs index 191308cca6..60a1c7c125 100644 --- a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs @@ -3,6 +3,7 @@ using osu.Framework.Allocation; using osu.Game.Rulesets; +using osu.Game.Rulesets.Configuration; namespace osu.Game.Overlays.Settings { @@ -14,6 +15,8 @@ namespace osu.Game.Overlays.Settings { private readonly Ruleset ruleset; + protected IRulesetConfigManager Config; + protected RulesetSettingsSubsection(Ruleset ruleset) { this.ruleset = ruleset; @@ -25,9 +28,9 @@ namespace osu.Game.Overlays.Settings { dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - var config = dependencies.Get().GetConfigFor(ruleset); - if (config != null) - dependencies.Cache(config); + Config = dependencies.Get().GetConfigFor(ruleset); + if (Config != null) + dependencies.Cache(Config); return dependencies; } diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index 71d7919dd4..0bfde148e7 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -70,7 +70,8 @@ namespace osu.Game.Rulesets.UI protected readonly Ruleset Ruleset; - private IRulesetConfigManager rulesetConfig; + protected IRulesetConfigManager Config { get; private set; } + private OnScreenDisplay onScreenDisplay; /// @@ -91,11 +92,11 @@ namespace osu.Game.Rulesets.UI onScreenDisplay = dependencies.Get(); - rulesetConfig = dependencies.Get().GetConfigFor(Ruleset); - if (rulesetConfig != null) + Config = dependencies.Get().GetConfigFor(Ruleset); + if (Config != null) { - dependencies.Cache(rulesetConfig); - onScreenDisplay?.BeginTracking(this, rulesetConfig); + dependencies.Cache(Config); + onScreenDisplay?.BeginTracking(this, Config); } return dependencies; @@ -143,10 +144,10 @@ namespace osu.Game.Rulesets.UI { base.Dispose(isDisposing); - if (rulesetConfig != null) + if (Config != null) { - onScreenDisplay?.StopTracking(this, rulesetConfig); - rulesetConfig = null; + onScreenDisplay?.StopTracking(this, Config); + Config = null; } } } From e550b3f52b46946af51c6550215bf3f3d184a63c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 18:25:55 +0900 Subject: [PATCH 084/304] Turn cache back on for chocolatey packages --- appveyor.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index ac6d6ebff8..7c08eb9e9c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,6 +2,9 @@ clone_depth: 1 version: '{branch}-{build}' image: Visual Studio 2017 configuration: Debug +cache: + - C:\ProgramData\chocolatey\bin -> appveyor.yml + - C:\ProgramData\chocolatey\lib -> appveyor.yml install: - cmd: git submodule update --init --recursive --depth=5 - cmd: choco install resharper-clt -y @@ -18,4 +21,4 @@ build: verbosity: minimal after_build: - cmd: inspectcode --o="inspectcodereport.xml" --projects:osu.Game* --caches-home="inspectcode" osu.sln > NUL - - cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors \ No newline at end of file + - cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors From 1e48582dc2eb7582938385be546a4916039c3576 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 11 Jul 2018 13:49:37 +0200 Subject: [PATCH 085/304] Instantly hide pause menu for quick retry --- osu.Game/Screens/Play/Player.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b406bda411..48a398a209 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -222,6 +222,7 @@ namespace osu.Game.Screens.Play //we want to hide the hitrenderer immediately (looks better). //we may be able to remove this once the mouse cursor trail is improved. RulesetContainer?.Hide(); + pauseContainer?.Hide(); Restart(); }, } From 5df2df9b3aa8bcf55fd78b949af89449bb74dc67 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 Jul 2018 12:15:22 +0900 Subject: [PATCH 086/304] Fix osu! logo handling non-left mouse buttons --- osu.Game/Screens/Menu/OsuLogo.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 16482b0e48..b74546310f 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -19,6 +19,7 @@ using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; using OpenTK; using OpenTK.Graphics; +using OpenTK.Input; namespace osu.Game.Screens.Menu { @@ -345,12 +346,16 @@ namespace osu.Game.Screens.Menu protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { + if (args.Button != MouseButton.Left) return false; + logoBounceContainer.ScaleTo(0.9f, 1000, Easing.Out); return true; } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { + if (args.Button != MouseButton.Left) return false; + logoBounceContainer.ScaleTo(1f, 500, Easing.OutElastic); return true; } From c67e11b2c78025f1a708f8a1f64d0a9a3b26eeac Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 Jul 2018 15:27:17 +0900 Subject: [PATCH 087/304] Restore old tooltip appear delay behaviour --- osu.Game/Graphics/Cursor/OsuTooltipContainer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs index c0e331148d..44156f6e83 100644 --- a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs @@ -21,6 +21,8 @@ namespace osu.Game.Graphics.Cursor { } + protected override double AppearDelay => (1 - CurrentTooltip.Alpha) * base.AppearDelay; // reduce appear delay if the tooltip is already partly visible. + public class OsuTooltip : Tooltip { private readonly Box background; From 6bcc8d1cbcc2a680dd4895c2870a68e30df841e9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 Jul 2018 19:56:41 +0900 Subject: [PATCH 088/304] 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 bfc7b21242..c8db3e4d66 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From a9f8c2acb8560b30f03d6aa3606680324d65da25 Mon Sep 17 00:00:00 2001 From: Criminalllz Date: Thu, 12 Jul 2018 20:36:57 +0200 Subject: [PATCH 089/304] Use Regex to only care about colors and commas when parsing a color. --- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index c8874c3bc7..c2ab156637 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Text.RegularExpressions; using osu.Framework.Logging; using osu.Game.Audio; using osu.Game.Beatmaps.ControlPoints; @@ -73,10 +74,12 @@ namespace osu.Game.Beatmaps.Formats bool isCombo = pair.Key.StartsWith(@"Combo"); - string[] split = pair.Value.Split(','); + line = Regex.Replace(pair.Value, "[^0-9,]", ""); + + string[] split = line.Split(','); if (split.Length != 3) - throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {pair.Value}"); + throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {line}"); if (!byte.TryParse(split[0], out var r) || !byte.TryParse(split[1], out var g) || !byte.TryParse(split[2], out var b)) throw new InvalidOperationException(@"Color must be specified with 8-bit integer components"); From 0676919496463b4dacd4e5e6782398cb689e30ee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 14:56:44 +0900 Subject: [PATCH 090/304] Fix incorrect corner radius --- osu.Game/Overlays/Direct/DownloadButton.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 68380b951c..2d678c572c 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -29,10 +29,9 @@ namespace osu.Game.Overlays.Direct Children = new Drawable[] { downloader = new BeatmapSetDownloader(set, noVideo), - new Container + new CircularContainer { RelativeSizeAxes = Axes.Both, - CornerRadius = 17, Masking = true, Child = background = new Box { From ee2c7c50adc0160648a8c097b9fd688d056ffcef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 16:28:18 +0900 Subject: [PATCH 091/304] Tidy up button hierarchy --- osu.Game.Tests/Visual/TestCaseIconButton.cs | 15 ++- osu.Game/Graphics/UserInterface/IconButton.cs | 111 +++--------------- .../UserInterface/OsuAnimatedButton.cs | 109 +++++++++++++++++ osu.Game/Overlays/Direct/DownloadButton.cs | 62 ++-------- osu.Game/Overlays/MusicController.cs | 18 ++- .../Compose/Timeline/TimelineButton.cs | 24 ++-- 6 files changed, 175 insertions(+), 164 deletions(-) create mode 100644 osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs diff --git a/osu.Game.Tests/Visual/TestCaseIconButton.cs b/osu.Game.Tests/Visual/TestCaseIconButton.cs index 16363da527..14cba71ec8 100644 --- a/osu.Game.Tests/Visual/TestCaseIconButton.cs +++ b/osu.Game.Tests/Visual/TestCaseIconButton.cs @@ -25,11 +25,7 @@ namespace osu.Game.Tests.Visual Children = new[] { new NamedIconButton("No change", new IconButton()), - new NamedIconButton("Background colours", new IconButton - { - FlashColour = Color4.DarkGreen, - HoverColour = Color4.Green, - }), + new NamedIconButton("Background colours", new ColouredIconButton()), new NamedIconButton("Full-width", new IconButton { ButtonSize = new Vector2(200, 30) }), new NamedIconButton("Unchanging size", new IconButton(), false), new NamedIconButton("Icon colours", new IconButton @@ -41,6 +37,15 @@ namespace osu.Game.Tests.Visual }; } + private class ColouredIconButton : IconButton + { + public ColouredIconButton() + { + FlashColour = Color4.DarkGreen; + HoverColour = Color4.Green; + } + } + private class NamedIconButton : Container { public NamedIconButton(string name, IconButton button, bool allowSizeChange = true) diff --git a/osu.Game/Graphics/UserInterface/IconButton.cs b/osu.Game/Graphics/UserInterface/IconButton.cs index 5a25fe641d..eca7bf57c8 100644 --- a/osu.Game/Graphics/UserInterface/IconButton.cs +++ b/osu.Game/Graphics/UserInterface/IconButton.cs @@ -3,31 +3,17 @@ 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; using osu.Framework.Input; -using osu.Game.Graphics.Containers; namespace osu.Game.Graphics.UserInterface { - public class IconButton : OsuClickableContainer + public class IconButton : OsuAnimatedButton { public const float BUTTON_SIZE = 30; - private Color4? flashColour; - /// - /// The colour that should be flashed when the is clicked. - /// - public Color4 FlashColour - { - get { return flashColour ?? Color4.White; } - set { flashColour = value; } - } - private Color4? iconColour; + /// /// The icon colour. This does not affect . /// @@ -42,6 +28,7 @@ namespace osu.Game.Graphics.UserInterface } private Color4? iconHoverColour; + /// /// The icon colour while the is hovered. /// @@ -51,20 +38,6 @@ namespace osu.Game.Graphics.UserInterface set { iconHoverColour = value; } } - private Color4? hoverColour; - /// - /// The background colour of the while it is hovered. - /// - public Color4 HoverColour - { - get { return hoverColour ?? Color4.White; } - set - { - hoverColour = value; - hover.Colour = value; - } - } - /// /// The icon. /// @@ -88,93 +61,39 @@ namespace osu.Game.Graphics.UserInterface /// public Vector2 ButtonSize { - get { return content.Size; } - set { content.Size = value; } + get => Content.Size; + set + { + Content.RelativeSizeAxes = Axes.None; + Content.Size = value; + } } - private readonly Container content; private readonly SpriteIcon icon; - private readonly Box hover; public IconButton() { AutoSizeAxes = Axes.Both; + ButtonSize = new Vector2(BUTTON_SIZE); - Children = new Drawable[] + Add(icon = new SpriteIcon { - content = new Container - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Size = new Vector2(BUTTON_SIZE), - CornerRadius = 5, - Masking = true, - EdgeEffect = new EdgeEffectParameters - { - Colour = Color4.Black.Opacity(0.04f), - Type = EdgeEffectType.Shadow, - Radius = 5, - }, - Children = new Drawable[] - { - hover = new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - }, - icon = new SpriteIcon - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Size = new Vector2(18), - } - } - } - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - if (hoverColour == null) - HoverColour = colours.Yellow.Opacity(0.6f); - - if (flashColour == null) - FlashColour = colours.Yellow; - - Enabled.ValueChanged += enabled => this.FadeColour(enabled ? Color4.White : colours.Gray9, 200, Easing.OutQuint); + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Size = new Vector2(18), + }); } protected override bool OnHover(InputState state) { - hover.FadeIn(500, Easing.OutQuint); icon.FadeColour(IconHoverColour, 500, Easing.OutQuint); return base.OnHover(state); } protected override void OnHoverLost(InputState state) { - hover.FadeOut(500, Easing.OutQuint); icon.FadeColour(IconColour, 500, Easing.OutQuint); base.OnHoverLost(state); } - - protected override bool OnClick(InputState state) - { - hover.FlashColour(FlashColour, 800, Easing.OutQuint); - return base.OnClick(state); - } - - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) - { - content.ScaleTo(0.75f, 2000, 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); - } } } diff --git a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs new file mode 100644 index 0000000000..990a2f20a9 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs @@ -0,0 +1,109 @@ +// 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.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; +using osu.Game.Graphics.Containers; +using OpenTK.Graphics; + +namespace osu.Game.Graphics.UserInterface +{ + /// + /// Highlight on hover, bounce on click. + /// + public class OsuAnimatedButton : OsuClickableContainer + { + /// + /// The colour that should be flashed when the is clicked. + /// + protected Color4 FlashColour = Color4.White.Opacity(0.3f); + + private Color4 hoverColour = Color4.White.Opacity(0.1f); + + /// + /// The background colour of the while it is hovered. + /// + protected Color4 HoverColour + { + get => hoverColour; + set + { + hoverColour = value; + hover.Colour = value; + } + } + + protected override Container Content => content; + + private readonly Container content; + private readonly Box hover; + + public OsuAnimatedButton() + { + base.Content.Add(content = new Container + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + CornerRadius = 5, + Masking = true, + EdgeEffect = new EdgeEffectParameters + { + Colour = Color4.Black.Opacity(0.04f), + Type = EdgeEffectType.Shadow, + Radius = 5, + }, + Children = new Drawable[] + { + hover = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = HoverColour, + Blending = BlendingMode.Additive, + Alpha = 0, + }, + } + }); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Enabled.BindValueChanged(enabled => this.FadeColour(enabled ? Color4.White : colours.Gray9, 200, Easing.OutQuint), true); + } + + protected override bool OnHover(InputState state) + { + hover.FadeIn(500, Easing.OutQuint); + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + hover.FadeOut(500, Easing.OutQuint); + base.OnHoverLost(state); + } + + protected override bool OnClick(InputState state) + { + hover.FlashColour(FlashColour, 800, Easing.OutQuint); + return base.OnClick(state); + } + + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + { + Content.ScaleTo(0.75f, 2000, 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); + } + } +} diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 2d678c572c..5c5e4907ed 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -3,19 +3,16 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; -using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; using OpenTK; -using OpenTK.Graphics; namespace osu.Game.Overlays.Direct { - public class DownloadButton : OsuClickableContainer + public class DownloadButton : OsuAnimatedButton { private readonly SpriteIcon icon; private readonly SpriteIcon checkmark; @@ -26,17 +23,13 @@ namespace osu.Game.Overlays.Direct public DownloadButton(BeatmapSetInfo set, bool noVideo = false) { - Children = new Drawable[] + AddRange(new Drawable[] { downloader = new BeatmapSetDownloader(set, noVideo), - new CircularContainer + background = new Box { RelativeSizeAxes = Axes.Both, - Masking = true, - Child = background = new Box - { - RelativeSizeAxes = Axes.Both, - }, + Depth = float.MaxValue }, icon = new SpriteIcon { @@ -53,18 +46,19 @@ namespace osu.Game.Overlays.Direct Size = Vector2.Zero, Icon = FontAwesome.fa_check, } - }; + }); Action = () => { - if (downloader.DownloadState.Value == BeatmapSetDownloader.DownloadStatus.Downloading) + if (downloader.DownloadState == BeatmapSetDownloader.DownloadStatus.Downloading) { + // todo: replace with ShakeContainer after https://github.com/ppy/osu/pull/2909 is merged. Content.MoveToX(-5, 50, Easing.OutSine).Then() .MoveToX(5, 100, Easing.InOutSine).Then() .MoveToX(-5, 100, Easing.InOutSine).Then() .MoveToX(0, 50, Easing.InSine); } - else if (downloader.DownloadState.Value == BeatmapSetDownloader.DownloadStatus.Downloaded) + else if (downloader.DownloadState == BeatmapSetDownloader.DownloadStatus.Downloaded) { // TODO: Jump to song select with this set when the capability is implemented } @@ -73,54 +67,24 @@ namespace osu.Game.Overlays.Direct downloader.Download(); } }; - - downloader.DownloadState.ValueChanged += _ => updateState(); - - Colour = Color4.White; } protected override void LoadComplete() { base.LoadComplete(); - updateState(); + downloader.DownloadState.BindValueChanged(updateState, true); } - [BackgroundDependencyLoader(permitNulls:true)] + [BackgroundDependencyLoader(permitNulls: true)] private void load(OsuColour colours) { this.colours = colours; } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + private void updateState(BeatmapSetDownloader.DownloadStatus state) { - Content.ScaleTo(0.9f, 1000, Easing.Out); - return base.OnMouseDown(state, args); - } - - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) - { - Content.ScaleTo(1f, 500, Easing.OutElastic); - return base.OnMouseUp(state, args); - } - - protected override bool OnHover(InputState state) - { - Content.ScaleTo(1.1f, 500, Easing.OutElastic); - return base.OnHover(state); - } - - protected override void OnHoverLost(InputState state) - { - Content.ScaleTo(1f, 500, Easing.OutElastic); - } - - private void updateState() - { - if (!IsLoaded) - return; - - switch (downloader.DownloadState.Value) + switch (state) { case BeatmapSetDownloader.DownloadStatus.NotDownloaded: background.FadeColour(colours.Gray4, 500, Easing.InOutExpo); diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index a57d5fd183..56af04c498 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -142,14 +142,14 @@ namespace osu.Game.Overlays Anchor = Anchor.Centre, Children = new[] { - prevButton = new IconButton + prevButton = new MusicIconButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, Action = prev, Icon = FontAwesome.fa_step_backward, }, - playButton = new IconButton + playButton = new MusicIconButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -158,7 +158,7 @@ namespace osu.Game.Overlays Action = play, Icon = FontAwesome.fa_play_circle_o, }, - nextButton = new IconButton + nextButton = new MusicIconButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -167,7 +167,7 @@ namespace osu.Game.Overlays }, } }, - playlistButton = new IconButton + playlistButton = new MusicIconButton { Origin = Anchor.Centre, Anchor = Anchor.CentreRight, @@ -405,6 +405,16 @@ namespace osu.Game.Overlays Prev } + private class MusicIconButton : IconButton + { + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + HoverColour = colours.YellowDark.Opacity(0.6f); + FlashColour = colours.Yellow; + } + } + private class Background : BufferedContainer { private readonly Sprite sprite; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineButton.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineButton.cs index f46cc7ef9d..5928fbaa1b 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineButton.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineButton.cs @@ -27,16 +27,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline public TimelineButton() { - InternalChild = button = new IconButton - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - IconColour = OsuColour.Gray(0.35f), - IconHoverColour = Color4.White, - HoverColour = OsuColour.Gray(0.25f), - FlashColour = OsuColour.Gray(0.5f), - Action = () => Action?.Invoke() - }; + InternalChild = button = new TimelineIconButton { Action = () => Action?.Invoke() }; button.Enabled.BindTo(Enabled); Width = button.ButtonSize.X; @@ -48,5 +39,18 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline button.ButtonSize = new Vector2(button.ButtonSize.X, DrawHeight); } + + private class TimelineIconButton : IconButton + { + public TimelineIconButton() + { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + IconColour = OsuColour.Gray(0.35f); + IconHoverColour = Color4.White; + HoverColour = OsuColour.Gray(0.25f); + FlashColour = OsuColour.Gray(0.5f); + } + } } } From 159b26509bf4e0be715afce89a603e80ce82f841 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 17:15:06 +0900 Subject: [PATCH 092/304] Improve visuals of difficulty icons --- .../Drawables/DifficultyColouredContainer.cs | 4 +-- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 28 +++++++++++++++---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs index 025ab0037f..7d00c35862 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs @@ -9,14 +9,14 @@ using OpenTK.Graphics; namespace osu.Game.Beatmaps.Drawables { - public class DifficultyColouredContainer : Container, IHasAccentColour + public abstract class DifficultyColouredContainer : Container, IHasAccentColour { public Color4 AccentColour { get; set; } private readonly BeatmapInfo beatmap; private OsuColour palette; - public DifficultyColouredContainer(BeatmapInfo beatmap) + protected DifficultyColouredContainer(BeatmapInfo beatmap) { this.beatmap = beatmap; } diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 42c98aef24..24604711d4 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -3,10 +3,14 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Beatmaps.Drawables { @@ -14,7 +18,8 @@ namespace osu.Game.Beatmaps.Drawables { private readonly BeatmapInfo beatmap; - public DifficultyIcon(BeatmapInfo beatmap) : base(beatmap) + public DifficultyIcon(BeatmapInfo beatmap) + : base(beatmap) { if (beatmap == null) throw new ArgumentNullException(nameof(beatmap)); @@ -28,16 +33,29 @@ namespace osu.Game.Beatmaps.Drawables { Children = new Drawable[] { - new SpriteIcon + new CircularContainer { + RelativeSizeAxes = Axes.Both, + Scale = new Vector2(0.84f), Anchor = Anchor.Centre, Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Colour = AccentColour, - Icon = FontAwesome.fa_circle + Masking = true, + EdgeEffect = new EdgeEffectParameters + { + Colour = Color4.Black.Opacity(0.08f), + Type = EdgeEffectType.Shadow, + Radius = 5, + }, + Child = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = AccentColour, + }, }, new ConstrainedIconContainer { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, // the null coalesce here is only present to make unit tests work (ruleset dlls aren't copied correctly for testing at the moment) Icon = beatmap.Ruleset?.CreateInstance().CreateIcon() ?? new SpriteIcon { Icon = FontAwesome.fa_question_circle_o } From 2d602c0e3c4e599564ef165f3f4159aec185af65 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 18:23:12 +0900 Subject: [PATCH 093/304] Add todo regarding playback skip logic --- osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs index 9a539072d0..cdec8c042f 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs @@ -41,6 +41,7 @@ namespace osu.Game.Storyboards.Drawables { base.Update(); + // TODO: this logic will need to be consolidated with other game samples like hitsounds. if (Time.Current < sample.Time) { // We've rewound before the start time of the sample From 3f44f5c60e8fca9f82abbb37d03b359500214134 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 18:34:38 +0900 Subject: [PATCH 094/304] Remove migration log output --- osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs index 98ce5def08..1f3c015614 100644 --- a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs +++ b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs @@ -8,7 +8,6 @@ namespace osu.Game.Migrations protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.Sql("DELETE FROM KeyBinding WHERE RulesetID = 1"); - Logger.Log("osu!taiko bindings have been reset due to new defaults", LoggingTarget.Runtime, LogLevel.Important); } protected override void Down(MigrationBuilder migrationBuilder) From bbb11a4066f0742d17636f7c7528b61deb4a3df9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 19:53:29 +0900 Subject: [PATCH 095/304] Fix regression in drawable rank first display --- osu.Game/Screens/Select/Leaderboards/DrawableRank.cs | 2 +- osu.Game/Users/Country.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs index 228633a41f..0c4b369f36 100644 --- a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs +++ b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs @@ -47,7 +47,7 @@ namespace osu.Game.Screens.Select.Leaderboards { Rank = newRank; - if (IsLoaded) + if (LoadState >= LoadState.Ready) updateTexture(); } } diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index 98b3a2df0c..80039eadad 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -43,7 +43,7 @@ namespace osu.Game.Users country = value; - if (IsLoaded) + if (LoadState >= LoadState.Ready) sprite.Texture = getFlagTexture(); } } From 96eb44425b26910f69594d8808beda2acb636380 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 20:32:22 +0900 Subject: [PATCH 096/304] Fix informational overlays not hiding when user toggles other overlay views Closes #3014. --- osu.Game/OsuGame.cs | 48 ++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index b654e5d53f..557b6e4469 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -19,6 +19,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using osu.Framework.Audio; +using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Platform; @@ -322,24 +323,6 @@ namespace osu.Game dependencies.Cache(notifications); dependencies.Cache(dialogOverlay); - // ensure only one of these overlays are open at once. - var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct }; - overlays.AddRange(singleDisplayOverlays); - - foreach (var overlay in singleDisplayOverlays) - { - overlay.StateChanged += state => - { - if (state == Visibility.Hidden) return; - - foreach (var c in singleDisplayOverlays) - { - if (c == overlay) continue; - c.State = Visibility.Hidden; - } - }; - } - var singleDisplaySideOverlays = new OverlayContainer[] { settings, notifications }; overlays.AddRange(singleDisplaySideOverlays); @@ -348,12 +331,7 @@ namespace osu.Game overlay.StateChanged += state => { if (state == Visibility.Hidden) return; - - foreach (var c in singleDisplaySideOverlays) - { - if (c == overlay) continue; - c.State = Visibility.Hidden; - } + singleDisplaySideOverlays.Where(o => o != overlay).ForEach(o => o.Hide()); }; } @@ -366,12 +344,24 @@ namespace osu.Game overlay.StateChanged += state => { if (state == Visibility.Hidden) return; + informationalOverlays.Where(o => o != overlay).ForEach(o => o.Hide()); + }; + } - foreach (var c in informationalOverlays) - { - if (c == overlay) continue; - c.State = Visibility.Hidden; - } + // ensure only one of these overlays are open at once. + var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct }; + overlays.AddRange(singleDisplayOverlays); + + foreach (var overlay in singleDisplayOverlays) + { + overlay.StateChanged += state => + { + // informational overlays should be dismissed on a show or hide of a full overlay. + informationalOverlays.ForEach(o => o.Hide()); + + if (state == Visibility.Hidden) return; + + singleDisplayOverlays.Where(o => o != overlay).ForEach(o => o.Hide()); }; } From 3308f8f823e0844c0f62868a6de5717c0e1daab3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 20:37:49 +0900 Subject: [PATCH 097/304] Fix focused overlays not blocking select action --- .../Graphics/Containers/OsuFocusedOverlayContainer.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 1d832d1c54..2e2e018fcb 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -69,10 +69,13 @@ namespace osu.Game.Graphics.Containers public virtual bool OnPressed(GlobalAction action) { - if (action == GlobalAction.Back) + switch (action) { - State = Visibility.Hidden; - return true; + case GlobalAction.Back: + State = Visibility.Hidden; + return true; + case GlobalAction.Select: + return true; } return false; From 67e7e371ccae21b8c3d7b0c0cc5dec51236d2faa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 20:40:49 +0900 Subject: [PATCH 098/304] Also block keyboard completely --- osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 2e2e018fcb..0dc6297ad2 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -22,8 +22,11 @@ namespace osu.Game.Graphics.Containers protected virtual bool PlaySamplesOnStateChange => true; + protected override bool BlockPassThroughKeyboard => true; + private PreviewTrackManager previewTrackManager; + protected readonly Bindable OverlayActivationMode = new Bindable(OverlayActivation.All); protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) From b33a0f772e585d77d8aaaeb59fbc57dd59341d07 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 21:00:52 +0900 Subject: [PATCH 099/304] Don't close toolbar --- 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 f8fdaf368c..bed4c98b53 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -186,7 +186,7 @@ namespace osu.Game /// The beatmap to select. public void PresentBeatmap(BeatmapSetInfo beatmap) { - CloseAllOverlays(); + CloseAllOverlays(false); Beatmap.Value = BeatmapManager.GetWorkingBeatmap(beatmap.Beatmaps.First()); From 95f314d9499dce6ae165d8c206bb6481756428a4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 21:04:10 +0900 Subject: [PATCH 100/304] Fix crash when clicking notification from player --- osu.Game/OsuGame.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index bed4c98b53..a96768629e 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -188,17 +188,19 @@ namespace osu.Game { CloseAllOverlays(false); - Beatmap.Value = BeatmapManager.GetWorkingBeatmap(beatmap.Beatmaps.First()); + void setBeatmap() => Beatmap.Value = BeatmapManager.GetWorkingBeatmap(beatmap.Beatmaps.First()); switch (currentScreen) { case SongSelect _: + setBeatmap(); break; default: // navigate to song select if we are not already there. var menu = (MainMenu)intro.ChildScreen; menu.MakeCurrent(); + setBeatmap(); menu.LoadToSolo(); break; } From 6d8923a37cc1a14772538d455cbc819332d3b423 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 21:08:41 +0900 Subject: [PATCH 101/304] Use better logic --- osu.Game/OsuGame.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 17c8ad8aa0..e2b93d0599 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -189,22 +189,31 @@ namespace osu.Game { CloseAllOverlays(false); - void setBeatmap() => Beatmap.Value = BeatmapManager.GetWorkingBeatmap(beatmap.Beatmaps.First()); + void setBeatmap() + { + if (Beatmap.Disabled) + { + Schedule(setBeatmap); + return; + } + + Beatmap.Value = BeatmapManager.GetWorkingBeatmap(beatmap.Beatmaps.First()); + }; switch (currentScreen) { case SongSelect _: - setBeatmap(); break; default: // navigate to song select if we are not already there. var menu = (MainMenu)intro.ChildScreen; menu.MakeCurrent(); - setBeatmap(); menu.LoadToSolo(); break; } + + setBeatmap(); } /// From fc3aff66896f146e48eb14df7e2d298ed1eff945 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 21:19:10 +0900 Subject: [PATCH 102/304] Fix initial colour --- osu.Game/Overlays/Direct/DownloadButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 5c5e4907ed..7758e171c5 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -72,8 +72,8 @@ namespace osu.Game.Overlays.Direct protected override void LoadComplete() { base.LoadComplete(); - downloader.DownloadState.BindValueChanged(updateState, true); + FinishTransforms(true); } [BackgroundDependencyLoader(permitNulls: true)] From ac4f25c5bc55c1bdc92977c18b9bd19913bee806 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 21:25:08 +0900 Subject: [PATCH 103/304] Make notifications less noisy --- osu.Desktop/Overlays/VersionManager.cs | 2 ++ osu.Game/Database/ArchiveModelManager.cs | 7 ++++++- osu.Game/Overlays/NotificationOverlay.cs | 3 ++- osu.Game/Overlays/Notifications/Notification.cs | 5 +++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 1129969694..0c564f8113 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -111,6 +111,8 @@ namespace osu.Desktop.Overlays private class UpdateCompleteNotification : SimpleNotification { + public override bool IsImportant => true; + public UpdateCompleteNotification(string version, Action openUrl = null) { Text = $"You are now running osu!lazer {version}.\nClick to see what's new!"; diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index cbf0df3227..c5591c00dc 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -116,7 +116,7 @@ namespace osu.Game.Database /// One or more archive locations on disk. public void Import(params string[] paths) { - var notification = new ProgressNotification + var notification = new ImportNotification { Text = "Import is initialising...", Progress = 0, @@ -407,5 +407,10 @@ namespace osu.Game.Database return new LegacyFilesystemReader(path); throw new InvalidFormatException($"{path} is not a valid archive"); } + + private class ImportNotification : ProgressNotification + { + public override bool IsImportant => true; + } } } diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index 3dc8f5ec15..d891cd96e8 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -128,7 +128,8 @@ namespace osu.Game.Overlays var section = sections.Children.FirstOrDefault(s => s.AcceptTypes.Any(accept => accept.IsAssignableFrom(ourType))); section?.Add(notification, notification.DisplayOnTop ? -runningDepth : runningDepth); - State = Visibility.Visible; + if (notification.IsImportant) + State = Visibility.Visible; updateCounts(); }); diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index d2b5ae1829..c98ac3b2cd 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -23,6 +23,11 @@ namespace osu.Game.Overlays.Notifications /// public event Action Closed; + /// + /// Whether this notification should forcefully display itself. + /// + public virtual bool IsImportant => false; + /// /// Run on user activating the notification. Return true to close. /// From ac35e8bd9939fd3d227915213dca699565e7ef38 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 21:27:09 +0900 Subject: [PATCH 104/304] Remove redundant empty statement --- 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 e2b93d0599..18a1d018d0 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -198,7 +198,7 @@ namespace osu.Game } Beatmap.Value = BeatmapManager.GetWorkingBeatmap(beatmap.Beatmaps.First()); - }; + } switch (currentScreen) { From 63c40e9051c0125aa41cdb50902873d65aca98a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 21:45:42 +0900 Subject: [PATCH 105/304] Remove unnecessary cache operations --- osu.Game/Screens/Select/SongSelect.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index a695aedda7..e6f33a7d29 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -202,10 +202,6 @@ namespace osu.Game.Screens.Select base.Ruleset.ValueChanged += r => updateSelectedBeatmap(beatmapNoDebounce); Ruleset.ValueChanged += r => base.Ruleset.Value = r; - dependencies.CacheAs(this); - dependencies.CacheAs(Ruleset); - dependencies.CacheAs>(Ruleset); - if (Footer != null) { Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2); From 4f5578245efc81f29a81a86b178150ad036ba2e7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 21:45:49 +0900 Subject: [PATCH 106/304] Fix regression causing previews to not play --- osu.Game/Screens/Select/SongSelect.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index e6f33a7d29..234508a195 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -315,13 +315,14 @@ namespace osu.Game.Screens.Select working = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value); } - ensurePlayingSelected(preview); working.Mods.Value = Enumerable.Empty(); Beatmap.Value = working; Ruleset.Value = ruleset; + ensurePlayingSelected(preview); + UpdateBeatmap(Beatmap.Value); } From 81e5a37d6d5c0a324ef864d498a80872c41b3142 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 14 Jul 2018 03:31:19 +0900 Subject: [PATCH 107/304] Enlist a few more important notifications --- osu.Desktop/Updater/SimpleUpdateManager.cs | 7 ++++++- .../Notifications/ProgressCompletionNotification.cs | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Desktop/Updater/SimpleUpdateManager.cs b/osu.Desktop/Updater/SimpleUpdateManager.cs index 6c363422f7..5b62298010 100644 --- a/osu.Desktop/Updater/SimpleUpdateManager.cs +++ b/osu.Desktop/Updater/SimpleUpdateManager.cs @@ -48,7 +48,7 @@ namespace osu.Desktop.Updater if (latest.TagName != version) { - notificationOverlay.Post(new SimpleNotification + notificationOverlay.Post(new UpdateNotification { Text = $"A newer release of osu! has been found ({version} → {latest.TagName}).\n\n" + "Click here to download the new version, which can be installed over the top of your existing installation", @@ -62,6 +62,11 @@ namespace osu.Desktop.Updater } } + private class UpdateNotification : SimpleNotification + { + public override bool IsImportant => true; + } + private string getBestUrl(GitHubRelease release) { GitHubAsset bestAsset = null; diff --git a/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs b/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs index 0711e49608..cd72049702 100644 --- a/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs @@ -9,6 +9,8 @@ namespace osu.Game.Overlays.Notifications { public class ProgressCompletionNotification : SimpleNotification { + public override bool IsImportant => true; + public ProgressCompletionNotification() { Icon = FontAwesome.fa_check; From 730eb2daa2e19d7c3c3fa3c7ef9eea8823166d08 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 14 Jul 2018 03:47:56 +0900 Subject: [PATCH 108/304] Reduce osu!direct panel width to allow three panels displayed at 16:9 resolutions --- osu.Game/Overlays/Direct/DirectGridPanel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index e286837746..4060f26008 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Direct public DirectGridPanel(BeatmapSetInfo beatmap) : base(beatmap) { - Width = 400; + Width = 380; Height = 140 + vertical_padding; //full height of all the elements plus vertical padding (autosize uses the image) } From c8697e1743560b627ce595e8ce4241c538290517 Mon Sep 17 00:00:00 2001 From: Berkan Diler Date: Sat, 14 Jul 2018 03:08:28 +0200 Subject: [PATCH 109/304] Fix KeyCounter counting clicks when game is paused --- 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 b406bda411..d8b714529b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -169,7 +169,7 @@ namespace osu.Game.Screens.Play OnPause = () => { pauseContainer.Retries = RestartCount; - hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused; + hudOverlay.KeyCounter.IsCounting = !pauseContainer.IsPaused; }, OnResume = () => hudOverlay.KeyCounter.IsCounting = true, Children = new[] From 453d58bcbd7be12fbc9e6f7ff85c37e6223776d6 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 15 Jul 2018 01:10:05 +0200 Subject: [PATCH 110/304] Hide Content instead of particular overlays --- 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 48a398a209..3992ebc6ee 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -222,7 +222,7 @@ namespace osu.Game.Screens.Play //we want to hide the hitrenderer immediately (looks better). //we may be able to remove this once the mouse cursor trail is improved. RulesetContainer?.Hide(); - pauseContainer?.Hide(); + Content.Hide(); Restart(); }, } From 6c861a16385d88340768f0a29c88f4b0cbf26b84 Mon Sep 17 00:00:00 2001 From: morguldir Date: Mon, 16 Jul 2018 01:04:41 +0200 Subject: [PATCH 111/304] Strip comments from everything except metadata --- .../Beatmaps/Formats/LegacyBeatmapDecoder.cs | 16 +++++++++------- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 15 +++++++++++---- .../Beatmaps/Formats/LegacyStoryboardDecoder.cs | 2 ++ osu.Game/Skinning/LegacySkinDecoder.cs | 2 ++ 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index c79938e613..641cdc4fd6 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -62,32 +62,34 @@ namespace osu.Game.Beatmaps.Formats protected override void ParseLine(Beatmap beatmap, Section section, string line) { + var stripped_line = StripComments(line); + switch (section) { case Section.General: - handleGeneral(line); + handleGeneral(stripped_line); return; case Section.Editor: - handleEditor(line); + handleEditor(stripped_line); return; case Section.Metadata: handleMetadata(line); return; case Section.Difficulty: - handleDifficulty(line); + handleDifficulty(stripped_line); return; case Section.Events: - handleEvent(line); + handleEvent(stripped_line); return; case Section.TimingPoints: - handleTimingPoint(line); + handleTimingPoint(stripped_line); return; case Section.HitObjects: - handleHitObject(line); + handleHitObject(stripped_line); return; } - base.ParseLine(beatmap, section, line); + base.ParseLine(beatmap, section, stripped_line); } private void handleGeneral(string line) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index c2ab156637..7a97281c76 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -58,6 +58,8 @@ namespace osu.Game.Beatmaps.Formats protected virtual void ParseLine(T output, Section section, string line) { + line = StripComments(line); + switch (section) { case Section.Colours: @@ -65,6 +67,13 @@ namespace osu.Game.Beatmaps.Formats return; } } + internal string StripComments(string line) + { + var index = line.IndexOf("//"); + if (index > 0) + return line.Substring(0, index); + return line; + } private bool hasComboColours; @@ -74,12 +83,10 @@ namespace osu.Game.Beatmaps.Formats bool isCombo = pair.Key.StartsWith(@"Combo"); - line = Regex.Replace(pair.Value, "[^0-9,]", ""); - - string[] split = line.Split(','); + string[] split = pair.Value.Split(','); if (split.Length != 3) - throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {line}"); + throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {pair.Value}"); if (!byte.TryParse(split[0], out var r) || !byte.TryParse(split[1], out var g) || !byte.TryParse(split[2], out var b)) throw new InvalidOperationException(@"Color must be specified with 8-bit integer components"); diff --git a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs index 868ae5206a..b418cbd5ec 100644 --- a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs @@ -42,6 +42,8 @@ namespace osu.Game.Beatmaps.Formats protected override void ParseLine(Storyboard storyboard, Section section, string line) { + line = StripComments(line); + switch (section) { case Section.Events: diff --git a/osu.Game/Skinning/LegacySkinDecoder.cs b/osu.Game/Skinning/LegacySkinDecoder.cs index 0ef54c7310..d4f1c5c6f1 100644 --- a/osu.Game/Skinning/LegacySkinDecoder.cs +++ b/osu.Game/Skinning/LegacySkinDecoder.cs @@ -14,6 +14,8 @@ namespace osu.Game.Skinning protected override void ParseLine(SkinConfiguration skin, Section section, string line) { + line = StripComments(line); + switch (section) { case Section.General: From 87a4bf3d92f143a737b1ef45ae75b19608846cab Mon Sep 17 00:00:00 2001 From: morguldir Date: Mon, 16 Jul 2018 01:08:30 +0200 Subject: [PATCH 112/304] Remove using directive for regex in LegacyDecoder --- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 7a97281c76..7ceb78c30d 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Text.RegularExpressions; using osu.Framework.Logging; using osu.Game.Audio; using osu.Game.Beatmaps.ControlPoints; From 429306aa876ef9bbe24aa16412d366124fd2c72d Mon Sep 17 00:00:00 2001 From: morguldir Date: Mon, 16 Jul 2018 01:54:20 +0200 Subject: [PATCH 113/304] Fix casing, use ordinal string comparison when stripping comments --- .../Beatmaps/Formats/LegacyBeatmapDecoder.cs | 16 ++++++++-------- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 641cdc4fd6..7664a4cea3 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -62,34 +62,34 @@ namespace osu.Game.Beatmaps.Formats protected override void ParseLine(Beatmap beatmap, Section section, string line) { - var stripped_line = StripComments(line); + var strippedLine = StripComments(line); switch (section) { case Section.General: - handleGeneral(stripped_line); + handleGeneral(strippedLine); return; case Section.Editor: - handleEditor(stripped_line); + handleEditor(strippedLine); return; case Section.Metadata: handleMetadata(line); return; case Section.Difficulty: - handleDifficulty(stripped_line); + handleDifficulty(strippedLine); return; case Section.Events: - handleEvent(stripped_line); + handleEvent(strippedLine); return; case Section.TimingPoints: - handleTimingPoint(stripped_line); + handleTimingPoint(strippedLine); return; case Section.HitObjects: - handleHitObject(stripped_line); + handleHitObject(strippedLine); return; } - base.ParseLine(beatmap, section, stripped_line); + base.ParseLine(beatmap, section, strippedLine); } private void handleGeneral(string line) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 7ceb78c30d..0698954bb6 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -68,7 +68,7 @@ namespace osu.Game.Beatmaps.Formats } internal string StripComments(string line) { - var index = line.IndexOf("//"); + var index = line.IndexOf("//", StringComparison.Ordinal); if (index > 0) return line.Substring(0, index); return line; From a12c47536b4158561d26315e004ad2476c748523 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 Jul 2018 13:00:21 +0900 Subject: [PATCH 114/304] Change default to being important --- osu.Desktop/Overlays/VersionManager.cs | 2 -- osu.Desktop/Updater/SimpleUpdateManager.cs | 7 +------ osu.Game/Beatmaps/BeatmapManager.cs | 18 +++++++++++++++++- osu.Game/Database/ArchiveModelManager.cs | 7 +------ .../Overlays/Notifications/Notification.cs | 2 +- .../ProgressCompletionNotification.cs | 2 -- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 0c564f8113..1129969694 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -111,8 +111,6 @@ namespace osu.Desktop.Overlays private class UpdateCompleteNotification : SimpleNotification { - public override bool IsImportant => true; - public UpdateCompleteNotification(string version, Action openUrl = null) { Text = $"You are now running osu!lazer {version}.\nClick to see what's new!"; diff --git a/osu.Desktop/Updater/SimpleUpdateManager.cs b/osu.Desktop/Updater/SimpleUpdateManager.cs index 5b62298010..6c363422f7 100644 --- a/osu.Desktop/Updater/SimpleUpdateManager.cs +++ b/osu.Desktop/Updater/SimpleUpdateManager.cs @@ -48,7 +48,7 @@ namespace osu.Desktop.Updater if (latest.TagName != version) { - notificationOverlay.Post(new UpdateNotification + notificationOverlay.Post(new SimpleNotification { Text = $"A newer release of osu! has been found ({version} → {latest.TagName}).\n\n" + "Click here to download the new version, which can be installed over the top of your existing installation", @@ -62,11 +62,6 @@ namespace osu.Desktop.Updater } } - private class UpdateNotification : SimpleNotification - { - public override bool IsImportant => true; - } - private string getBestUrl(GitHubRelease release) { GitHubAsset bestAsset = null; diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index fc4d43080e..49aa4eca28 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -143,7 +143,7 @@ namespace osu.Game.Beatmaps return; } - var downloadNotification = new ProgressNotification + var downloadNotification = new DownloadNotification { CompletionText = $"Imported {beatmapSetInfo.Metadata.Artist} - {beatmapSetInfo.Metadata.Title}!", Text = $"Downloading {beatmapSetInfo.Metadata.Artist} - {beatmapSetInfo.Metadata.Title}", @@ -453,5 +453,21 @@ namespace osu.Game.Beatmaps protected override Texture GetBackground() => null; protected override Track GetTrack() => null; } + + private class DownloadNotification : ProgressNotification + { + public override bool IsImportant => false; + + protected override Notification CreateCompletionNotification() => new SilencedProgressCompletionNotification + { + Activated = CompletionClickAction, + Text = CompletionText + }; + + private class SilencedProgressCompletionNotification : ProgressCompletionNotification + { + public override bool IsImportant => false; + } + } } } diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index c5591c00dc..cbf0df3227 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -116,7 +116,7 @@ namespace osu.Game.Database /// One or more archive locations on disk. public void Import(params string[] paths) { - var notification = new ImportNotification + var notification = new ProgressNotification { Text = "Import is initialising...", Progress = 0, @@ -407,10 +407,5 @@ namespace osu.Game.Database return new LegacyFilesystemReader(path); throw new InvalidFormatException($"{path} is not a valid archive"); } - - private class ImportNotification : ProgressNotification - { - public override bool IsImportant => true; - } } } diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index c98ac3b2cd..3a3fcb54e0 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -26,7 +26,7 @@ namespace osu.Game.Overlays.Notifications /// /// Whether this notification should forcefully display itself. /// - public virtual bool IsImportant => false; + public virtual bool IsImportant => true; /// /// Run on user activating the notification. Return true to close. diff --git a/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs b/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs index cd72049702..0711e49608 100644 --- a/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs @@ -9,8 +9,6 @@ namespace osu.Game.Overlays.Notifications { public class ProgressCompletionNotification : SimpleNotification { - public override bool IsImportant => true; - public ProgressCompletionNotification() { Icon = FontAwesome.fa_check; From dbc538abbe5806b5f8a273cffbae1e200fc90a78 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 Jul 2018 16:17:22 +0900 Subject: [PATCH 115/304] Use Enum.HasFlag With .NET core 2.0+ this is as efficient as the ugly code we've been using. --- .../Legacy/DistanceObjectPatternGenerator.cs | 16 ++++----- .../Legacy/HitObjectPatternGenerator.cs | 35 ++++++++++--------- .../Objects/Drawables/Pieces/BodyPiece.cs | 2 +- .../Replays/ManiaReplayFrame.cs | 2 +- .../Beatmaps/Formats/LegacyBeatmapDecoder.cs | 4 +-- osu.Game/Graphics/SpriteIcon.cs | 2 +- osu.Game/Graphics/UserInterface/BarGraph.cs | 8 ++--- osu.Game/Graphics/UserInterface/LineGraph.cs | 2 +- .../Graphics/UserInterface/TwoLayerButton.cs | 10 +++--- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 4 +-- .../Objects/Legacy/ConvertHitObjectParser.cs | 14 ++++---- .../Replays/Legacy/LegacyReplayFrame.cs | 8 ++--- osu.Game/Screens/Play/SquareGraph.cs | 2 +- 13 files changed, 55 insertions(+), 54 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 280c2f45d4..8d0d78120a 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -133,26 +133,26 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (ConversionDifficulty > 6.5) { - if ((convertType & PatternType.LowProbability) > 0) + if (convertType.HasFlag(PatternType.LowProbability)) return generateNRandomNotes(HitObject.StartTime, 0.78, 0.3, 0); return generateNRandomNotes(HitObject.StartTime, 0.85, 0.36, 0.03); } if (ConversionDifficulty > 4) { - if ((convertType & PatternType.LowProbability) > 0) + if (convertType.HasFlag(PatternType.LowProbability)) return generateNRandomNotes(HitObject.StartTime, 0.43, 0.08, 0); return generateNRandomNotes(HitObject.StartTime, 0.56, 0.18, 0); } if (ConversionDifficulty > 2.5) { - if ((convertType & PatternType.LowProbability) > 0) + if (convertType.HasFlag(PatternType.LowProbability)) return generateNRandomNotes(HitObject.StartTime, 0.3, 0, 0); return generateNRandomNotes(HitObject.StartTime, 0.37, 0.08, 0); } - if ((convertType & PatternType.LowProbability) > 0) + if (convertType.HasFlag(PatternType.LowProbability)) return generateNRandomNotes(HitObject.StartTime, 0.17, 0, 0); return generateNRandomNotes(HitObject.StartTime, 0.27, 0, 0); } @@ -209,7 +209,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy var pattern = new Pattern(); int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); - if ((convertType & PatternType.ForceNotStack) > 0 && PreviousPattern.ColumnWithObjects < TotalColumns) + if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns) { while (PreviousPattern.ColumnHasObject(nextColumn)) nextColumn = Random.Next(RandomStart, TotalColumns); @@ -361,7 +361,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy bool isDoubleSample(SampleInfo sample) => sample.Name == SampleInfo.HIT_CLAP || sample.Name == SampleInfo.HIT_FINISH; - bool canGenerateTwoNotes = (convertType & PatternType.LowProbability) == 0; + bool canGenerateTwoNotes = !convertType.HasFlag(PatternType.LowProbability); canGenerateTwoNotes &= HitObject.Samples.Any(isDoubleSample) || sampleInfoListAt(HitObject.StartTime).Any(isDoubleSample); if (canGenerateTwoNotes) @@ -391,7 +391,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int columnRepeat = Math.Min(spanCount, TotalColumns); int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); - if ((convertType & PatternType.ForceNotStack) > 0 && PreviousPattern.ColumnWithObjects < TotalColumns) + if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns) { while (PreviousPattern.ColumnHasObject(nextColumn)) nextColumn = Random.Next(RandomStart, TotalColumns); @@ -425,7 +425,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy var pattern = new Pattern(); int holdColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); - if ((convertType & PatternType.ForceNotStack) > 0 && PreviousPattern.ColumnWithObjects < TotalColumns) + if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns) { while (PreviousPattern.ColumnHasObject(holdColumn)) holdColumn = Random.Next(RandomStart, TotalColumns); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index 0e839d87a2..84ebfdb839 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -21,7 +21,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy private readonly PatternType convertType; - public HitObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, double previousTime, Vector2 previousPosition, double density, PatternType lastStair, IBeatmap originalBeatmap) + public HitObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, double previousTime, Vector2 previousPosition, double density, + PatternType lastStair, IBeatmap originalBeatmap) : base(random, hitObject, beatmap, previousPattern, originalBeatmap) { if (previousTime > hitObject.StartTime) throw new ArgumentOutOfRangeException(nameof(previousTime)); @@ -79,7 +80,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy else convertType |= PatternType.LowProbability; - if ((convertType & PatternType.KeepSingle) == 0) + if (!convertType.HasFlag(PatternType.KeepSingle)) { if (HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_FINISH) && TotalColumns != 8) convertType |= PatternType.Mirror; @@ -107,7 +108,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int lastColumn = PreviousPattern.HitObjects.FirstOrDefault()?.Column ?? 0; - if ((convertType & PatternType.Reverse) > 0 && PreviousPattern.HitObjects.Any()) + if (convertType.HasFlag(PatternType.Reverse) && PreviousPattern.HitObjects.Any()) { // Generate a new pattern by copying the last hit objects in reverse-column order for (int i = RandomStart; i < TotalColumns; i++) @@ -117,7 +118,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy return pattern; } - if ((convertType & PatternType.Cycle) > 0 && PreviousPattern.HitObjects.Count() == 1 + if (convertType.HasFlag(PatternType.Cycle) && PreviousPattern.HitObjects.Count() == 1 // If we convert to 7K + 1, let's not overload the special key && (TotalColumns != 8 || lastColumn != 0) // Make sure the last column was not the centre column @@ -130,7 +131,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy return pattern; } - if ((convertType & PatternType.ForceStack) > 0 && PreviousPattern.HitObjects.Any()) + if (convertType.HasFlag(PatternType.ForceStack) && PreviousPattern.HitObjects.Any()) { // Generate a new pattern by placing on the already filled columns for (int i = RandomStart; i < TotalColumns; i++) @@ -142,7 +143,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (PreviousPattern.HitObjects.Count() == 1) { - if ((convertType & PatternType.Stair) > 0) + if (convertType.HasFlag(PatternType.Stair)) { // Generate a new pattern by placing on the next column, cycling back to the start if there is no "next" int targetColumn = lastColumn + 1; @@ -153,7 +154,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy return pattern; } - if ((convertType & PatternType.ReverseStair) > 0) + if (convertType.HasFlag(PatternType.ReverseStair)) { // Generate a new pattern by placing on the previous column, cycling back to the end if there is no "previous" int targetColumn = lastColumn - 1; @@ -165,10 +166,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy } } - if ((convertType & PatternType.KeepSingle) > 0) + if (convertType.HasFlag(PatternType.KeepSingle)) return pattern = generateRandomNotes(1); - if ((convertType & PatternType.Mirror) > 0) + if (convertType.HasFlag(PatternType.Mirror)) { if (ConversionDifficulty > 6.5) return pattern = generateRandomPatternWithMirrored(0.12, 0.38, 0.12); @@ -179,21 +180,21 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (ConversionDifficulty > 6.5) { - if ((convertType & PatternType.LowProbability) > 0) + if (convertType.HasFlag(PatternType.LowProbability)) return pattern = generateRandomPattern(0.78, 0.42, 0, 0); return pattern = generateRandomPattern(1, 0.62, 0, 0); } if (ConversionDifficulty > 4) { - if ((convertType & PatternType.LowProbability) > 0) + if (convertType.HasFlag(PatternType.LowProbability)) return pattern = generateRandomPattern(0.35, 0.08, 0, 0); return pattern = generateRandomPattern(0.52, 0.15, 0, 0); } if (ConversionDifficulty > 2) { - if ((convertType & PatternType.LowProbability) > 0) + if (convertType.HasFlag(PatternType.LowProbability)) return pattern = generateRandomPattern(0.18, 0, 0, 0); return pattern = generateRandomPattern(0.45, 0, 0, 0); } @@ -204,9 +205,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { foreach (var obj in pattern.HitObjects) { - if ((convertType & PatternType.Stair) > 0 && obj.Column == TotalColumns - 1) + if (convertType.HasFlag(PatternType.Stair) && obj.Column == TotalColumns - 1) StairType = PatternType.ReverseStair; - if ((convertType & PatternType.ReverseStair) > 0 && obj.Column == RandomStart) + if (convertType.HasFlag(PatternType.ReverseStair) && obj.Column == RandomStart) StairType = PatternType.Stair; } } @@ -225,7 +226,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { var pattern = new Pattern(); - bool allowStacking = (convertType & PatternType.ForceNotStack) == 0; + bool allowStacking = !convertType.HasFlag(PatternType.ForceNotStack); if (!allowStacking) noteCount = Math.Min(noteCount, TotalColumns - RandomStart - PreviousPattern.ColumnWithObjects); @@ -235,7 +236,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { while (pattern.ColumnHasObject(nextColumn) || PreviousPattern.ColumnHasObject(nextColumn) && !allowStacking) { - if ((convertType & PatternType.Gathered) > 0) + if (convertType.HasFlag(PatternType.Gathered)) { nextColumn++; if (nextColumn == TotalColumns) @@ -367,7 +368,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { addToCentre = false; - if ((convertType & PatternType.ForceNotStack) > 0) + if (convertType.HasFlag(PatternType.ForceNotStack)) return getRandomNoteCount(1 / 2f + p2 / 2, p2, (p2 + p3) / 2, p3); switch (TotalColumns) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs index 4ab2da208a..dbba56501e 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs @@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if ((invalidation & Invalidation.DrawSize) > 0) + if (invalidation.HasFlag(Invalidation.DrawSize)) subtractionCache.Invalidate(); return base.Invalidate(invalidation, source, shallPropagate); diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs index bc9fd6e06f..e2dc2d6a03 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs @@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Mania.Replays { var isSpecial = stage.IsSpecialColumn(counter); - if ((activeColumns & 1) > 0) + if (activeColumns.HasFlag(1)) Actions.Add(isSpecial ? specialAction : normalAction); if (isSpecial) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index c79938e613..81f1e056fb 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -306,8 +306,8 @@ namespace osu.Game.Beatmaps.Formats if (split.Length >= 8) { int effectFlags = int.Parse(split[7]); - kiaiMode = (effectFlags & 1) > 0; - omitFirstBarSignature = (effectFlags & 8) > 0; + kiaiMode = effectFlags.HasFlag(1); + omitFirstBarSignature = effectFlags.HasFlag(8); } string stringSampleSet = sampleSet.ToString().ToLower(); diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index 6acd20719e..244844f6d5 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -84,7 +84,7 @@ namespace osu.Game.Graphics public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if ((invalidation & Invalidation.Colour) > 0 && Shadow) + if (invalidation.HasFlag(Invalidation.Colour) && Shadow) layout.Invalidate(); return base.Invalidate(invalidation, source, shallPropagate); } diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index d065ecdd5f..0ba49929e9 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -26,10 +26,10 @@ namespace osu.Game.Graphics.UserInterface set { direction = value; - base.Direction = (direction & BarDirection.Horizontal) > 0 ? FillDirection.Vertical : FillDirection.Horizontal; + base.Direction = direction.HasFlag(BarDirection.Horizontal) ? FillDirection.Vertical : FillDirection.Horizontal; foreach (var bar in Children) { - bar.Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / Children.Count) : new Vector2(1.0f / Children.Count, 1); + bar.Size = direction.HasFlag(BarDirection.Horizontal) ? new Vector2(1, 1.0f / Children.Count) : new Vector2(1.0f / Children.Count, 1); bar.Direction = direction; } } @@ -56,14 +56,14 @@ namespace osu.Game.Graphics.UserInterface if (bar.Bar != null) { bar.Bar.Length = length; - bar.Bar.Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, size) : new Vector2(size, 1); + bar.Bar.Size = direction.HasFlag(BarDirection.Horizontal) ? new Vector2(1, size) : new Vector2(size, 1); } else { Add(new Bar { RelativeSizeAxes = Axes.Both, - Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, size) : new Vector2(size, 1), + Size = direction.HasFlag(BarDirection.Horizontal) ? new Vector2(1, size) : new Vector2(size, 1), Length = length, Direction = Direction, }); diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index 3cb2446acc..c4e1e1d283 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -75,7 +75,7 @@ namespace osu.Game.Graphics.UserInterface public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if ((invalidation & Invalidation.DrawSize) > 0) + if (invalidation.HasFlag(Invalidation.DrawSize)) pathCached.Invalidate(); return base.Invalidate(invalidation, source, shallPropagate); diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index f490306acf..dd5454314d 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -56,15 +56,15 @@ namespace osu.Game.Graphics.UserInterface set { base.Origin = value; - c1.Origin = c1.Anchor = (value & Anchor.x2) > 0 ? Anchor.TopLeft : Anchor.TopRight; - c2.Origin = c2.Anchor = (value & Anchor.x2) > 0 ? Anchor.TopRight : Anchor.TopLeft; + c1.Origin = c1.Anchor = value.HasFlag(Anchor.x2) ? Anchor.TopLeft : Anchor.TopRight; + c2.Origin = c2.Anchor = value.HasFlag(Anchor.x2) ? Anchor.TopRight : Anchor.TopLeft; - X = (value & Anchor.x2) > 0 ? SIZE_RETRACTED.X * shear * 0.5f : 0; + X = value.HasFlag(Anchor.x2) ? SIZE_RETRACTED.X * shear * 0.5f : 0; Remove(c1); Remove(c2); - c1.Depth = (value & Anchor.x2) > 0 ? 0 : 1; - c2.Depth = (value & Anchor.x2) > 0 ? 1 : 0; + c1.Depth = value.HasFlag(Anchor.x2) ? 0 : 1; + c2.Depth = value.HasFlag(Anchor.x2) ? 1 : 0; Add(c1); Add(c2); } diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index c7870a72de..4514f3c33c 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -118,9 +118,9 @@ namespace osu.Game.Overlays.Toolbar { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.Both, //stops us being considered in parent's autosize - Anchor = (TooltipAnchor & Anchor.x0) > 0 ? Anchor.BottomLeft : Anchor.BottomRight, + Anchor = TooltipAnchor.HasFlag(Anchor.x0) ? Anchor.BottomLeft : Anchor.BottomRight, Origin = TooltipAnchor, - Position = new Vector2((TooltipAnchor & Anchor.x0) > 0 ? 5 : -5, 5), + Position = new Vector2(TooltipAnchor.HasFlag(Anchor.x0) ? 5 : -5, 5), Alpha = 0, Children = new[] { diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 95589d8953..48512a71c2 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -39,14 +39,14 @@ namespace osu.Game.Rulesets.Objects.Legacy HitObject result = null; - if ((type & ConvertHitObjectType.Circle) > 0) + if (type.HasFlag(ConvertHitObjectType.Circle)) { result = CreateHit(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo); if (split.Length > 5) readCustomSampleBanks(split[5], bankInfo); } - else if ((type & ConvertHitObjectType.Slider) > 0) + else if (type.HasFlag(ConvertHitObjectType.Slider)) { var pos = new Vector2(int.Parse(split[0]), int.Parse(split[1])); @@ -150,14 +150,14 @@ namespace osu.Game.Rulesets.Objects.Legacy result = CreateSlider(pos, combo, points, length, curveType, repeatCount, nodeSamples); } - else if ((type & ConvertHitObjectType.Spinner) > 0) + else if (type.HasFlag(ConvertHitObjectType.Spinner)) { result = CreateSpinner(new Vector2(512, 384) / 2, Convert.ToDouble(split[5], CultureInfo.InvariantCulture) + offset); if (split.Length > 6) readCustomSampleBanks(split[6], bankInfo); } - else if ((type & ConvertHitObjectType.Hold) > 0) + else if (type.HasFlag(ConvertHitObjectType.Hold)) { // Note: Hold is generated by BMS converts @@ -266,7 +266,7 @@ namespace osu.Game.Rulesets.Objects.Legacy } }; - if ((type & LegacySoundType.Finish) > 0) + if (type.HasFlag(LegacySoundType.Finish)) { soundTypes.Add(new SampleInfo { @@ -276,7 +276,7 @@ namespace osu.Game.Rulesets.Objects.Legacy }); } - if ((type & LegacySoundType.Whistle) > 0) + if (type.HasFlag(LegacySoundType.Whistle)) { soundTypes.Add(new SampleInfo { @@ -286,7 +286,7 @@ namespace osu.Game.Rulesets.Objects.Legacy }); } - if ((type & LegacySoundType.Clap) > 0) + if (type.HasFlag(LegacySoundType.Clap)) { soundTypes.Add(new SampleInfo { diff --git a/osu.Game/Rulesets/Replays/Legacy/LegacyReplayFrame.cs b/osu.Game/Rulesets/Replays/Legacy/LegacyReplayFrame.cs index d39d765bfe..5bd56e0cc0 100644 --- a/osu.Game/Rulesets/Replays/Legacy/LegacyReplayFrame.cs +++ b/osu.Game/Rulesets/Replays/Legacy/LegacyReplayFrame.cs @@ -15,10 +15,10 @@ namespace osu.Game.Rulesets.Replays.Legacy public bool MouseLeft => MouseLeft1 || MouseLeft2; public bool MouseRight => MouseRight1 || MouseRight2; - public bool MouseLeft1 => (ButtonState & ReplayButtonState.Left1) > 0; - public bool MouseRight1 => (ButtonState & ReplayButtonState.Right1) > 0; - public bool MouseLeft2 => (ButtonState & ReplayButtonState.Left2) > 0; - public bool MouseRight2 => (ButtonState & ReplayButtonState.Right2) > 0; + public bool MouseLeft1 => ButtonState.HasFlag(ReplayButtonState.Left1); + public bool MouseRight1 => ButtonState.HasFlag(ReplayButtonState.Right1); + public bool MouseLeft2 => ButtonState.HasFlag(ReplayButtonState.Left2); + public bool MouseRight2 => ButtonState.HasFlag(ReplayButtonState.Right2); public ReplayButtonState ButtonState; diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 8ffd04b35c..1d13b4548d 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -71,7 +71,7 @@ namespace osu.Game.Screens.Play public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if ((invalidation & Invalidation.DrawSize) > 0) + if (invalidation.HasFlag(Invalidation.DrawSize)) layout.Invalidate(); return base.Invalidate(invalidation, source, shallPropagate); } From 98cddc0c04ef451e3fffcdc393ab628086a7f121 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 Jul 2018 16:26:37 +0900 Subject: [PATCH 116/304] Fix some legacy cases --- .../Replays/ManiaReplayFrame.cs | 2 +- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs index e2dc2d6a03..bc9fd6e06f 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs @@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Mania.Replays { var isSpecial = stage.IsSpecialColumn(counter); - if (activeColumns.HasFlag(1)) + if ((activeColumns & 1) > 0) Actions.Add(isSpecial ? specialAction : normalAction); if (isSpecial) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 81f1e056fb..770dab9eeb 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -305,9 +305,9 @@ namespace osu.Game.Beatmaps.Formats bool omitFirstBarSignature = false; if (split.Length >= 8) { - int effectFlags = int.Parse(split[7]); - kiaiMode = effectFlags.HasFlag(1); - omitFirstBarSignature = effectFlags.HasFlag(8); + EffectFlags effectFlags = (EffectFlags)int.Parse(split[7]); + kiaiMode = effectFlags.HasFlag(EffectFlags.Kiai); + omitFirstBarSignature = effectFlags.HasFlag(EffectFlags.OmitFirstBarLine); } string stringSampleSet = sampleSet.ToString().ToLower(); @@ -405,5 +405,13 @@ namespace osu.Game.Beatmaps.Formats private double getOffsetTime() => ApplyOffsets ? offset : 0; private double getOffsetTime(double time) => time + (ApplyOffsets ? offset : 0); + + [Flags] + internal enum EffectFlags + { + None = 0, + Kiai = 1, + OmitFirstBarLine = 8 + } } } From 58fe434dd01d0953586bbe7a1b9f00111502effe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 Jul 2018 16:39:52 +0900 Subject: [PATCH 117/304] Don't use in invalidation logic to avoid incorrect execution --- osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs | 2 +- osu.Game/Graphics/SpriteIcon.cs | 2 +- osu.Game/Graphics/UserInterface/LineGraph.cs | 2 +- osu.Game/Screens/Play/SquareGraph.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs index dbba56501e..4ab2da208a 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs @@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if (invalidation.HasFlag(Invalidation.DrawSize)) + if ((invalidation & Invalidation.DrawSize) > 0) subtractionCache.Invalidate(); return base.Invalidate(invalidation, source, shallPropagate); diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index 244844f6d5..6acd20719e 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -84,7 +84,7 @@ namespace osu.Game.Graphics public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if (invalidation.HasFlag(Invalidation.Colour) && Shadow) + if ((invalidation & Invalidation.Colour) > 0 && Shadow) layout.Invalidate(); return base.Invalidate(invalidation, source, shallPropagate); } diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index c4e1e1d283..3cb2446acc 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -75,7 +75,7 @@ namespace osu.Game.Graphics.UserInterface public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if (invalidation.HasFlag(Invalidation.DrawSize)) + if ((invalidation & Invalidation.DrawSize) > 0) pathCached.Invalidate(); return base.Invalidate(invalidation, source, shallPropagate); diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 1d13b4548d..8ffd04b35c 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -71,7 +71,7 @@ namespace osu.Game.Screens.Play public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if (invalidation.HasFlag(Invalidation.DrawSize)) + if ((invalidation & Invalidation.DrawSize) > 0) layout.Invalidate(); return base.Invalidate(invalidation, source, shallPropagate); } From fc77e01ba980a03ed366820f5a7b645ff11ba0ff Mon Sep 17 00:00:00 2001 From: morguldir Date: Mon, 16 Jul 2018 16:35:55 +0200 Subject: [PATCH 118/304] Fix formatting, make StripComments protected Don't strip comments when calling ParseLine --- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 2 +- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 7664a4cea3..d1b47b449b 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -89,7 +89,7 @@ namespace osu.Game.Beatmaps.Formats return; } - base.ParseLine(beatmap, section, strippedLine); + base.ParseLine(beatmap, section, line); } private void handleGeneral(string line) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 0698954bb6..91c1c98438 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -66,7 +66,8 @@ namespace osu.Game.Beatmaps.Formats return; } } - internal string StripComments(string line) + + protected string StripComments(string line) { var index = line.IndexOf("//", StringComparison.Ordinal); if (index > 0) From da300baff156caf2a6c02f7921daf2ee096bd65b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 Jul 2018 00:06:51 +0900 Subject: [PATCH 119/304] Update hide logic --- osu.Game/Screens/Play/Player.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index f97ee27ced..49a180902b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -219,10 +219,7 @@ namespace osu.Game.Screens.Play { if (!IsCurrentScreen) return; - //we want to hide the hitrenderer immediately (looks better). - //we may be able to remove this once the mouse cursor trail is improved. - RulesetContainer?.Hide(); - Content.Hide(); + pauseContainer.Hide(); Restart(); }, } From b967fe714b8ef7b13c6266efe52043ad94a488d1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 Jul 2018 14:29:22 +0900 Subject: [PATCH 120/304] Fix lead-in time now being long enough in many cases --- osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs | 10 ++++++++++ osu.Game/Rulesets/UI/RulesetContainer.cs | 6 ++++++ osu.Game/Screens/Play/Player.cs | 7 +++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs index 33d4e16662..c18d180783 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.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.Linq; using osu.Framework.Graphics.Cursor; using osu.Framework.Input; using OpenTK; @@ -46,6 +47,15 @@ namespace osu.Game.Rulesets.Osu.UI protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new OsuReplayInputHandler(replay); + public override double GameplayStartTime + { + get + { + var first = (OsuHitObject)Objects.First(); + return first.StartTime - first.TimePreempt; + } + } + protected override Vector2 GetAspectAdjustedSize() { var aspectSize = DrawSize.X * 0.75f < DrawSize.Y ? new Vector2(DrawSize.X, DrawSize.X * 0.75f) : new Vector2(DrawSize.Y * 4f / 3f, DrawSize.Y); diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index 0bfde148e7..d68afdfedc 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -56,6 +56,12 @@ namespace osu.Game.Rulesets.UI public abstract IEnumerable Objects { get; } + /// + /// The point in time at which gameplay starts, including any required lead-in for display purposes. + /// Defaults to two seconds before the first . Override as necessary. + /// + public virtual double GameplayStartTime => Objects.First().StartTime - 2000; + private readonly Lazy playfield; /// diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 49a180902b..fc439a48c5 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -138,10 +138,9 @@ namespace osu.Game.Screens.Play sourceClock = (IAdjustableClock)working.Track ?? new StopwatchClock(); adjustableClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; - var firstObjectTime = RulesetContainer.Objects.First().StartTime; adjustableClock.Seek(AllowLeadIn - ? Math.Min(0, firstObjectTime - Math.Max(beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, beatmap.BeatmapInfo.AudioLeadIn)) - : firstObjectTime); + ? Math.Min(RulesetContainer.GameplayStartTime, beatmap.HitObjects.First().StartTime - beatmap.BeatmapInfo.AudioLeadIn) + : RulesetContainer.GameplayStartTime); adjustableClock.ProcessFrame(); @@ -199,7 +198,7 @@ namespace osu.Game.Screens.Play Anchor = Anchor.Centre, Origin = Anchor.Centre }, - new SkipOverlay(firstObjectTime) + new SkipOverlay(RulesetContainer.GameplayStartTime) { Clock = Clock, // skip button doesn't want to use the audio clock directly ProcessCustomClock = false, From 825941aff11aecbeae4666f6a9e46e8bac08c0ca Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 Jul 2018 14:35:09 +0900 Subject: [PATCH 121/304] Use switch with type matching in place of if-else where possible --- .../CatchBeatmapConversionTest.cs | 22 ++++--- .../Difficulty/CatchDifficultyCalculator.cs | 13 ++-- .../Legacy/EndTimeObjectPatternGenerator.cs | 14 ++-- .../Replays/ManiaAutoGenerator.cs | 13 ++-- .../Replays/OsuAutoGenerator.cs | 65 ++++++++++--------- .../UI/OsuRulesetContainer.cs | 16 +++-- .../Scoring/TaikoScoreProcessor.cs | 40 ++++++------ osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 16 +++-- .../UI/TaikoRulesetContainer.cs | 32 ++++----- .../BeatmapSet/Buttons/DownloadButton.cs | 15 +++-- osu.Game/Overlays/OnScreenDisplay.cs | 19 +++--- .../Difficulty/DifficultyCalculator.cs | 16 +++-- 12 files changed, 150 insertions(+), 131 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs index 4b95a6754e..162624da57 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs @@ -28,18 +28,20 @@ namespace osu.Game.Rulesets.Catch.Tests protected override IEnumerable CreateConvertValue(HitObject hitObject) { - if (hitObject is JuiceStream stream) + switch (hitObject) { - foreach (var nested in stream.NestedHitObjects) - yield return new ConvertValue((CatchHitObject)nested); + case JuiceStream stream: + foreach (var nested in stream.NestedHitObjects) + yield return new ConvertValue((CatchHitObject)nested); + break; + case BananaShower shower: + foreach (var nested in shower.NestedHitObjects) + yield return new ConvertValue((CatchHitObject)nested); + break; + default: + yield return new ConvertValue((CatchHitObject)hitObject); + break; } - else if (hitObject is BananaShower shower) - { - foreach (var nested in shower.NestedHitObjects) - yield return new ConvertValue((CatchHitObject)nested); - } - else - yield return new ConvertValue((CatchHitObject)hitObject); } protected override Ruleset CreateRuleset() => new CatchRuleset(); diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index 31c56c37c4..978b71576e 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -46,13 +46,16 @@ namespace osu.Game.Rulesets.Catch.Difficulty foreach (var hitObject in beatmap.HitObjects) { - // We want to only consider fruits that contribute to the combo. Droplets are addressed as accuracy and spinners are not relevant for "skill" calculations. - if (hitObject is Fruit) + switch (hitObject) { - difficultyHitObjects.Add(new CatchDifficultyHitObject((CatchHitObject)hitObject, halfCatchWidth)); + // We want to only consider fruits that contribute to the combo. Droplets are addressed as accuracy and spinners are not relevant for "skill" calculations. + case Fruit _: + difficultyHitObjects.Add(new CatchDifficultyHitObject((CatchHitObject)hitObject, halfCatchWidth)); + break; + case JuiceStream _: + difficultyHitObjects.AddRange(hitObject.NestedHitObjects.OfType().Where(o => !(o is TinyDroplet)).Select(o => new CatchDifficultyHitObject(o, halfCatchWidth))); + break; } - if (hitObject is JuiceStream) - difficultyHitObjects.AddRange(hitObject.NestedHitObjects.OfType().Where(o => !(o is TinyDroplet)).Select(o => new CatchDifficultyHitObject(o, halfCatchWidth))); } difficultyHitObjects.Sort((a, b) => a.BaseHitObject.StartTime.CompareTo(b.BaseHitObject.StartTime)); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs index b902ee63c6..06b4b8a27e 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs @@ -33,15 +33,19 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy bool generateHold = endTime - HitObject.StartTime >= 100; - if (TotalColumns == 8) + switch (TotalColumns) { - if (HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_FINISH) && endTime - HitObject.StartTime < 1000) + case 8 when HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_FINISH) && endTime - HitObject.StartTime < 1000: addToPattern(pattern, 0, generateHold); - else + break; + case 8: addToPattern(pattern, getNextRandomColumn(RandomStart), generateHold); + break; + default: + if (TotalColumns > 0) + addToPattern(pattern, getNextRandomColumn(0), generateHold); + break; } - else if (TotalColumns > 0) - addToPattern(pattern, getNextRandomColumn(0), generateHold); return pattern; } diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs index d006a3e1c7..0eef540d97 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs @@ -56,10 +56,15 @@ namespace osu.Game.Rulesets.Mania.Replays { foreach (var point in group) { - if (point is HitPoint) - actions.Add(columnActions[point.Column]); - if (point is ReleasePoint) - actions.Remove(columnActions[point.Column]); + switch (point) + { + case HitPoint _: + actions.Add(columnActions[point.Column]); + break; + case ReleasePoint _: + actions.Remove(columnActions[point.Column]); + break; + } } Replay.Frames.Add(new ManiaReplayFrame(group.First().Time, actions.ToArray())); diff --git a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs index ad4ea343d2..7322f65066 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs @@ -285,44 +285,45 @@ namespace osu.Game.Rulesets.Osu.Replays AddFrameToReplay(startFrame); - // We add intermediate frames for spinning / following a slider here. - if (h is Spinner) + switch (h) { - Spinner s = h as Spinner; - - Vector2 difference = startPosition - SPINNER_CENTRE; - - float radius = difference.Length; - float angle = radius == 0 ? 0 : (float)Math.Atan2(difference.Y, difference.X); - - double t; - - for (double j = h.StartTime + FrameDelay; j < s.EndTime; j += FrameDelay) + // We add intermediate frames for spinning / following a slider here. + case Spinner spinner: { - t = ApplyModsToTime(j - h.StartTime) * spinnerDirection; + Vector2 difference = startPosition - SPINNER_CENTRE; - Vector2 pos = SPINNER_CENTRE + CirclePosition(t / 20 + angle, SPIN_RADIUS); - AddFrameToReplay(new OsuReplayFrame((int)j, new Vector2(pos.X, pos.Y), action)); + float radius = difference.Length; + float angle = radius == 0 ? 0 : (float)Math.Atan2(difference.Y, difference.X); + + double t; + + for (double j = h.StartTime + FrameDelay; j < spinner.EndTime; j += FrameDelay) + { + t = ApplyModsToTime(j - h.StartTime) * spinnerDirection; + + Vector2 pos = SPINNER_CENTRE + CirclePosition(t / 20 + angle, SPIN_RADIUS); + AddFrameToReplay(new OsuReplayFrame((int)j, new Vector2(pos.X, pos.Y), action)); + } + + t = ApplyModsToTime(spinner.EndTime - h.StartTime) * spinnerDirection; + Vector2 endPosition = SPINNER_CENTRE + CirclePosition(t / 20 + angle, SPIN_RADIUS); + + AddFrameToReplay(new OsuReplayFrame(spinner.EndTime, new Vector2(endPosition.X, endPosition.Y), action)); + + endFrame.Position = endPosition; + break; } - - t = ApplyModsToTime(s.EndTime - h.StartTime) * spinnerDirection; - Vector2 endPosition = SPINNER_CENTRE + CirclePosition(t / 20 + angle, SPIN_RADIUS); - - AddFrameToReplay(new OsuReplayFrame(s.EndTime, new Vector2(endPosition.X, endPosition.Y), action)); - - endFrame.Position = endPosition; - } - else if (h is Slider) - { - Slider s = h as Slider; - - for (double j = FrameDelay; j < s.Duration; j += FrameDelay) + case Slider slider: { - Vector2 pos = s.StackedPositionAt(j / s.Duration); - AddFrameToReplay(new OsuReplayFrame(h.StartTime + j, new Vector2(pos.X, pos.Y), action)); - } + for (double j = FrameDelay; j < slider.Duration; j += FrameDelay) + { + Vector2 pos = slider.StackedPositionAt(j / slider.Duration); + AddFrameToReplay(new OsuReplayFrame(h.StartTime + j, new Vector2(pos.X, pos.Y), action)); + } - AddFrameToReplay(new OsuReplayFrame(s.EndTime, new Vector2(s.StackedEndPosition.X, s.StackedEndPosition.Y), action)); + AddFrameToReplay(new OsuReplayFrame(slider.EndTime, new Vector2(slider.StackedEndPosition.X, slider.StackedEndPosition.Y), action)); + break; + } } // We only want to let go of our button if we are at the end of the current replay. Otherwise something is still going on after us so we need to keep the button pressed! diff --git a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs index 33d4e16662..3558c347a9 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs @@ -33,14 +33,16 @@ namespace osu.Game.Rulesets.Osu.UI protected override DrawableHitObject GetVisualRepresentation(OsuHitObject h) { - if (h is HitCircle circle) - return new DrawableHitCircle(circle); + switch (h) + { + case HitCircle circle: + return new DrawableHitCircle(circle); + case Slider slider: + return new DrawableSlider(slider); + case Spinner spinner: + return new DrawableSpinner(spinner); + } - if (h is Slider slider) - return new DrawableSlider(slider); - - if (h is Spinner spinner) - return new DrawableSpinner(spinner); return null; } diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index c7f75e44fa..6347cf9da2 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -80,30 +80,30 @@ namespace osu.Game.Rulesets.Taiko.Scoring foreach (var obj in beatmap.HitObjects) { - if (obj is Hit) + switch (obj) { - AddJudgement(new TaikoJudgement { Result = HitResult.Great }); - if (obj.IsStrong) - AddJudgement(new TaikoStrongHitJudgement()); - } - else if (obj is DrumRoll) - { - for (int i = 0; i < ((DrumRoll)obj).NestedHitObjects.OfType().Count(); i++) - { - AddJudgement(new TaikoDrumRollTickJudgement { Result = HitResult.Great }); + case Hit _: + AddJudgement(new TaikoJudgement { Result = HitResult.Great }); + if (obj.IsStrong) + AddJudgement(new TaikoStrongHitJudgement()); + break; + case DrumRoll _: + for (int i = 0; i < ((DrumRoll)obj).NestedHitObjects.OfType().Count(); i++) + { + AddJudgement(new TaikoDrumRollTickJudgement { Result = HitResult.Great }); + + if (obj.IsStrong) + AddJudgement(new TaikoStrongHitJudgement()); + } + + AddJudgement(new TaikoJudgement { Result = HitResult.Great }); if (obj.IsStrong) AddJudgement(new TaikoStrongHitJudgement()); - } - - AddJudgement(new TaikoJudgement { Result = HitResult.Great }); - - if (obj.IsStrong) - AddJudgement(new TaikoStrongHitJudgement()); - } - else if (obj is Swell) - { - AddJudgement(new TaikoJudgement { Result = HitResult.Great }); + break; + case Swell _: + AddJudgement(new TaikoJudgement { Result = HitResult.Great }); + break; } } } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 7fdd3cd1e2..8cb260776a 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -212,13 +212,15 @@ namespace osu.Game.Rulesets.Taiko.UI base.Add(h); - var barline = h as DrawableBarLine; - if (barline != null) - barlineContainer.Add(barline.CreateProxy()); - - var taikoObject = h as DrawableTaikoHitObject; - if (taikoObject != null) - topLevelHitContainer.Add(taikoObject.CreateProxiedContent()); + switch (h) + { + case DrawableBarLine barline: + barlineContainer.Add(barline.CreateProxy()); + break; + case DrawableTaikoHitObject taikoObject: + topLevelHitContainer.Add(taikoObject.CreateProxiedContent()); + break; + } } internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs index e04b4d45f6..2fa4627bde 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs @@ -98,32 +98,22 @@ namespace osu.Game.Rulesets.Taiko.UI protected override DrawableHitObject GetVisualRepresentation(TaikoHitObject h) { - var centreHit = h as CentreHit; - if (centreHit != null) + switch (h) { - if (h.IsStrong) + case CentreHit centreHit when h.IsStrong: return new DrawableCentreHitStrong(centreHit); - return new DrawableCentreHit(centreHit); - } - - var rimHit = h as RimHit; - if (rimHit != null) - { - if (h.IsStrong) + case CentreHit centreHit: + return new DrawableCentreHit(centreHit); + case RimHit rimHit when h.IsStrong: return new DrawableRimHitStrong(rimHit); - return new DrawableRimHit(rimHit); + case RimHit rimHit: + return new DrawableRimHit(rimHit); + case DrumRoll drumRoll: + return new DrawableDrumRoll(drumRoll); + case Swell swell: + return new DrawableSwell(swell); } - var drumRoll = h as DrumRoll; - if (drumRoll != null) - { - return new DrawableDrumRoll(drumRoll); - } - - var swell = h as Swell; - if (swell != null) - return new DrawableSwell(swell); - return null; } diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs index 7a227f4bfa..223ca1c904 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs @@ -73,12 +73,17 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons downloader.Download(); }; - downloader.DownloadState.ValueChanged += d => + downloader.DownloadState.ValueChanged += state => { - if (d == BeatmapSetDownloader.DownloadStatus.Downloaded) - this.FadeOut(200); - else if (d == BeatmapSetDownloader.DownloadStatus.NotDownloaded) - this.FadeIn(200); + switch (state) + { + case BeatmapSetDownloader.DownloadStatus.Downloaded: + this.FadeOut(200); + break; + case BeatmapSetDownloader.DownloadStatus.NotDownloaded: + this.FadeIn(200); + break; + } }; } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 753cd33cc6..5a5b90ee25 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -188,16 +188,17 @@ namespace osu.Game.Overlays int optionCount = 0; int selectedOption = -1; - if (description.RawValue is bool) + switch (description.RawValue) { - optionCount = 1; - if ((bool)description.RawValue) selectedOption = 0; - } - else if (description.RawValue is Enum) - { - var values = Enum.GetValues(description.RawValue.GetType()); - optionCount = values.Length; - selectedOption = Convert.ToInt32(description.RawValue); + case bool val: + optionCount = 1; + if (val) selectedOption = 0; + break; + case Enum _: + var values = Enum.GetValues(description.RawValue.GetType()); + optionCount = values.Length; + selectedOption = Convert.ToInt32(description.RawValue); + break; } textLine2.Origin = optionCount > 0 ? Anchor.BottomCentre : Anchor.Centre; diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index 8f9651ab09..0c9e03cedd 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -62,12 +62,16 @@ namespace osu.Game.Rulesets.Difficulty IEnumerable createDifficultyAdjustmentModCombinations(IEnumerable currentSet, Mod[] adjustmentSet, int currentSetCount = 0, int adjustmentSetStart = 0) { - // Initial-case: Empty current set - if (currentSetCount == 0) - yield return new NoModMod(); - - if (currentSetCount == 1) - yield return currentSet.Single(); + switch (currentSetCount) + { + case 0: + // Initial-case: Empty current set + yield return new NoModMod(); + break; + case 1: + yield return currentSet.Single(); + break; + } if (currentSetCount > 1) yield return new MultiMod(currentSet.ToArray()); From 827c5c4939e1a2abbcc5888fe9754f2a9fd1e086 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 17 Jul 2018 15:14:03 +0900 Subject: [PATCH 122/304] Remove scroll direction from ScrolingPlayfield constructor --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 4 +++- osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs | 2 +- osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs | 2 +- osu.Game.Rulesets.Mania/UI/Column.cs | 3 +-- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 6 ++---- osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs | 5 ----- osu.Game.Rulesets.Mania/UI/ManiaStage.cs | 5 ++--- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 3 ++- osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs | 1 - osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs | 7 ++++--- 11 files changed, 17 insertions(+), 23 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 9eca8f6871..ea3b6fb0e0 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -23,8 +23,10 @@ namespace osu.Game.Rulesets.Catch.UI private readonly CatcherArea catcherArea; public CatchPlayfield(BeatmapDifficulty difficulty, Func> getVisualRepresentation) - : base(ScrollingDirection.Down, BASE_WIDTH) + : base(BASE_WIDTH) { + Direction.Value = ScrollingDirection.Down; + Container explodingFruitContainer; Anchor = Anchor.TopCentre; diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs index de2bfaed9c..cceee718ca 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs @@ -86,7 +86,7 @@ namespace osu.Game.Rulesets.Mania.Tests private Drawable createColumn(ScrollingDirection direction, ManiaAction action) { - var column = new Column(direction) + var column = new Column { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs index 8046c46fc1..b1bb7f5187 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs @@ -105,7 +105,7 @@ namespace osu.Game.Rulesets.Mania.Tests { var specialAction = ManiaAction.Special1; - var stage = new ManiaStage(direction, 0, new StageDefinition { Columns = 2 }, ref action, ref specialAction) { VisibleTimeRange = { Value = 2000 } }; + var stage = new ManiaStage(0, new StageDefinition { Columns = 2 }, ref action, ref specialAction) { VisibleTimeRange = { Value = 2000 } }; stages.Add(stage); return new ScrollingTestContainer(direction) diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index 8465258055..063531da45 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -32,8 +32,7 @@ namespace osu.Game.Rulesets.Mania.UI protected override Container Content => hitObjectArea; - public Column(ScrollingDirection direction) - : base(direction) + public Column() { RelativeSizeAxes = Axes.Y; Width = column_width; diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 2f8ad7b17e..d6781a6e8f 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -12,7 +12,6 @@ using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Mania.Configuration; -using osu.Game.Rulesets.UI.Scrolling; namespace osu.Game.Rulesets.Mania.UI { @@ -21,8 +20,7 @@ namespace osu.Game.Rulesets.Mania.UI public List Columns => stages.SelectMany(x => x.Columns).ToList(); private readonly List stages = new List(); - public ManiaPlayfield(ScrollingDirection direction, List stageDefinitions) - : base(direction) + public ManiaPlayfield(List stageDefinitions) { if (stageDefinitions == null) throw new ArgumentNullException(nameof(stageDefinitions)); @@ -42,7 +40,7 @@ namespace osu.Game.Rulesets.Mania.UI int firstColumnIndex = 0; for (int i = 0; i < stageDefinitions.Count; i++) { - var newStage = new ManiaStage(direction, firstColumnIndex, stageDefinitions[i], ref normalColumnAction, ref specialColumnAction); + var newStage = new ManiaStage(firstColumnIndex, stageDefinitions[i], ref normalColumnAction, ref specialColumnAction); newStage.VisibleTimeRange.BindTo(VisibleTimeRange); playfieldGrid.Content[0][i] = newStage; diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index abc9705119..aaa4505b5e 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Mania.UI return dependencies; } - protected sealed override Playfield CreatePlayfield() => new ManiaPlayfield(scrollingInfo.Direction, Beatmap.Stages) + protected sealed override Playfield CreatePlayfield() => new ManiaPlayfield(Beatmap.Stages) { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs index f1ff0665cd..4d6c5a747a 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs @@ -11,11 +11,6 @@ namespace osu.Game.Rulesets.Mania.UI { private readonly IBindable direction = new Bindable(); - public ManiaScrollingPlayfield(ScrollingDirection direction) - : base(direction) - { - } - [BackgroundDependencyLoader] private void load(IScrollingInfo scrollingInfo) { diff --git a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs index 4c7deb4567..a0ff8780ad 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs @@ -43,8 +43,7 @@ namespace osu.Game.Rulesets.Mania.UI private readonly int firstColumnIndex; - public ManiaStage(ScrollingDirection direction, int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction) - : base(direction) + public ManiaStage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction) { this.firstColumnIndex = firstColumnIndex; @@ -124,7 +123,7 @@ namespace osu.Game.Rulesets.Mania.UI for (int i = 0; i < definition.Columns; i++) { var isSpecial = definition.IsSpecialColumn(i); - var column = new Column(direction) + var column = new Column { IsSpecial = isSpecial, Action = { Value = isSpecial ? specialColumnStartAction++ : normalColumnStartAction++ } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 7fdd3cd1e2..a47c433631 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -58,8 +58,9 @@ namespace osu.Game.Rulesets.Taiko.UI private readonly Box background; public TaikoPlayfield(ControlPointInfo controlPoints) - : base(ScrollingDirection.Left) { + Direction.Value = ScrollingDirection.Left; + AddRangeInternal(new Drawable[] { backgroundContainer = new Container diff --git a/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs b/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs index 9b48ec17bd..bbc9d2b860 100644 --- a/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs +++ b/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs @@ -117,7 +117,6 @@ namespace osu.Game.Tests.Visual public new readonly ScrollingDirection Direction; public TestPlayfield(ScrollingDirection direction) - : base(direction) { Direction = direction; diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index cfcfca157b..7146ad8064 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -57,22 +57,23 @@ namespace osu.Game.Rulesets.UI.Scrolling /// public new ScrollingHitObjectContainer HitObjects => (ScrollingHitObjectContainer)base.HitObjects; + /// + /// The direction in which s in this should scroll. + /// protected readonly Bindable Direction = new Bindable(); /// /// Creates a new . /// - /// The direction in which s in this container should scroll. /// The width to scale the internal coordinate space to. /// May be null if scaling based on is desired. If is also null, no scaling will occur. /// /// The height to scale the internal coordinate space to. /// May be null if scaling based on is desired. If is also null, no scaling will occur. /// - protected ScrollingPlayfield(ScrollingDirection direction, float? customWidth = null, float? customHeight = null) + protected ScrollingPlayfield(float? customWidth = null, float? customHeight = null) : base(customWidth, customHeight) { - Direction.Value = direction; } [BackgroundDependencyLoader] From 0b66f63f7d436f518abbf0fe1c1b40546e492fdd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 17 Jul 2018 15:35:32 +0900 Subject: [PATCH 123/304] Invert flow order of hitobjects between composer and mask layers --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 12 +++++++++++- .../Compose/Layers/HitObjectMaskLayer.cs | 18 ++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 0c91c9f548..1c55f0a09f 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -28,6 +28,9 @@ namespace osu.Game.Rulesets.Edit private RulesetContainer rulesetContainer; private readonly List layerContainers = new List(); + public IEnumerable HitObjects => rulesetContainer.Playfield.HitObjects.Objects; + public IEnumerable AliveHitObjects => rulesetContainer.Playfield.HitObjects.AliveObjects; + private readonly IBindable beatmap = new Bindable(); protected HitObjectComposer(Ruleset ruleset) @@ -60,7 +63,7 @@ namespace osu.Game.Rulesets.Edit }; var layerAboveRuleset = CreateLayerContainer(); - layerAboveRuleset.Child = new HitObjectMaskLayer(rulesetContainer.Playfield, this); + layerAboveRuleset.Child = new HitObjectMaskLayer(); layerContainers.Add(layerBelowRuleset); layerContainers.Add(layerAboveRuleset); @@ -110,6 +113,13 @@ namespace osu.Game.Rulesets.Edit toolboxCollection.Items[0].Select(); } + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + { + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + dependencies.CacheAs(this); + return dependencies; + } + protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index b9a8e9914a..9e5b7300ab 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -8,30 +8,24 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.UI; namespace osu.Game.Screens.Edit.Screens.Compose.Layers { public class HitObjectMaskLayer : CompositeDrawable { - private readonly Playfield playfield; - private readonly HitObjectComposer composer; - private MaskContainer maskContainer; + private HitObjectComposer composer; - public HitObjectMaskLayer(Playfield playfield, HitObjectComposer composer) + public HitObjectMaskLayer() { - // we need the playfield as HitObjects may not be initialised until its BDL. - this.playfield = playfield; - - this.composer = composer; - RelativeSizeAxes = Axes.Both; } [BackgroundDependencyLoader] - private void load() + private void load(HitObjectComposer composer) { + this.composer = composer; + maskContainer = new MaskContainer(); var maskSelection = composer.CreateMaskSelection(); @@ -54,7 +48,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers dragLayer.CreateProxy() }; - foreach (var obj in playfield.HitObjects.Objects) + foreach (var obj in composer.HitObjects) addMask(obj); } From 48190e3b5a055e7e0c17176d92171430b36349ef Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 17 Jul 2018 15:48:51 +0900 Subject: [PATCH 124/304] Make NestedPlayfields non-null --- osu.Game/Rulesets/UI/Playfield.cs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index f2c9b49900..43999e3d29 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -1,10 +1,13 @@ // 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 osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Allocation; +using osu.Framework.Extensions.IEnumerableExtensions; namespace osu.Game.Rulesets.UI { @@ -15,11 +18,8 @@ namespace osu.Game.Rulesets.UI /// public HitObjectContainer HitObjects { get; private set; } - /// - /// All the s nested inside this playfield. - /// - public IReadOnlyList NestedPlayfields => nestedPlayfields; - private List nestedPlayfields; + private readonly Lazy> nestedPlayfields = new Lazy>(); + public IEnumerable NestedPlayfields => nestedPlayfields.IsValueCreated ? nestedPlayfields.Value : Enumerable.Empty(); /// /// A container for keeping track of DrawableHitObjects. @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.UI /// /// Performs post-processing tasks (if any) after all DrawableHitObjects are loaded into this Playfield. /// - public virtual void PostProcess() => nestedPlayfields?.ForEach(p => p.PostProcess()); + public virtual void PostProcess() => NestedPlayfields.ForEach(p => p.PostProcess()); /// /// Adds a DrawableHitObject to this Playfield. @@ -67,13 +67,7 @@ namespace osu.Game.Rulesets.UI /// This does not add the to the draw hierarchy. /// /// The to add. - protected void AddNested(Playfield otherPlayfield) - { - if (nestedPlayfields == null) - nestedPlayfields = new List(); - - nestedPlayfields.Add(otherPlayfield); - } + protected void AddNested(Playfield otherPlayfield) => nestedPlayfields.Value.Add(otherPlayfield); /// /// Creates the container that will be used to contain the s. From 3905a9105c5bc1e563bd2a02704ee47015cc6914 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 17 Jul 2018 15:51:10 +0900 Subject: [PATCH 125/304] Add a playfield method to retrieve all hitobjects --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 3 +-- osu.Game/Rulesets/UI/Playfield.cs | 13 +++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 1c55f0a09f..8b199c7e02 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -28,8 +28,7 @@ namespace osu.Game.Rulesets.Edit private RulesetContainer rulesetContainer; private readonly List layerContainers = new List(); - public IEnumerable HitObjects => rulesetContainer.Playfield.HitObjects.Objects; - public IEnumerable AliveHitObjects => rulesetContainer.Playfield.HitObjects.AliveObjects; + public IEnumerable HitObjects => rulesetContainer.Playfield.AllHitObjects; private readonly IBindable beatmap = new Bindable(); diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index 43999e3d29..7a7360afe2 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -14,13 +14,22 @@ namespace osu.Game.Rulesets.UI public abstract class Playfield : ScalableContainer { /// - /// The HitObjects contained in this Playfield. + /// The contained in this Playfield. /// public HitObjectContainer HitObjects { get; private set; } - private readonly Lazy> nestedPlayfields = new Lazy>(); + /// + /// All the s contained in this and all . + /// + public IEnumerable AllHitObjects => HitObjects?.Objects.Concat(NestedPlayfields.SelectMany(p => p.AllHitObjects)) ?? Enumerable.Empty(); + + /// + /// All s nested inside this . + /// public IEnumerable NestedPlayfields => nestedPlayfields.IsValueCreated ? nestedPlayfields.Value : Enumerable.Empty(); + private readonly Lazy> nestedPlayfields = new Lazy>(); + /// /// A container for keeping track of DrawableHitObjects. /// From 48c1561676540486e59e03cfd6c4cb0f10445bcb Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 17 Jul 2018 16:01:14 +0900 Subject: [PATCH 126/304] Remove now unnecessary mask layer --- .../Edit/Layers/ManiaHitObjectMaskLayer.cs | 24 ------------------- 1 file changed, 24 deletions(-) delete mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/ManiaHitObjectMaskLayer.cs diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/ManiaHitObjectMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/ManiaHitObjectMaskLayer.cs deleted file mode 100644 index a2df612d79..0000000000 --- a/osu.Game.Rulesets.Mania/Edit/Layers/ManiaHitObjectMaskLayer.cs +++ /dev/null @@ -1,24 +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.Configuration; -using osu.Game.Screens.Edit.Screens.Compose.Layers; -using OpenTK; - -namespace osu.Game.Rulesets.Mania.Edit.Layers -{ - public class ManiaHitObjectMaskLayer : HitObjectMaskLayer - { - public readonly IBindable Inverted = new Bindable(); - - public ManiaHitObjectMaskLayer() - { - Inverted.ValueChanged += invertedChanged; - } - - private void invertedChanged(bool newValue) - { - Scale = new Vector2(1, newValue ? -1 : 1); - } - } -} From c51fe6a119c60414a994a4848ebe58fa1d1153c3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 17 Jul 2018 16:01:47 +0900 Subject: [PATCH 127/304] Remove more unused stuff --- .../Edit/ManiaHitObjectComposer.cs | 4 ---- .../Screens/Compose/Layers/HitObjectMaskLayer.cs | 14 -------------- 2 files changed, 18 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 03553480d9..b1968d0aff 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -10,8 +10,6 @@ using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; using System.Collections.Generic; -using osu.Game.Rulesets.Mania.Edit.Layers; -using osu.Game.Screens.Edit.Screens.Compose.Layers; namespace osu.Game.Rulesets.Mania.Edit { @@ -42,7 +40,5 @@ namespace osu.Game.Rulesets.Mania.Edit return base.CreateMaskFor(hitObject); } - - protected override HitObjectMaskLayer CreateHitObjectMaskLayer() => new ManiaHitObjectMaskLayer(); } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index 6d73c03cad..db4ea05e59 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.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.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -72,18 +71,5 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers maskContainer.Add(mask); } - - /// - /// Removes the mask for a . - /// - /// The to remove the mask for. - private void removeMask(DrawableHitObject hitObject) - { - var mask = maskContainer.FirstOrDefault(h => h.HitObject == hitObject); - if (mask == null) - return; - - maskContainer.Remove(mask); - } } } From 9f933187e9cc071d5ad269287ecebc5467b37b36 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 Jul 2018 16:33:08 +0900 Subject: [PATCH 128/304] Apply review feedback --- .../Difficulty/CatchDifficultyCalculator.cs | 4 ++-- osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs | 4 ++-- osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index 978b71576e..a763989750 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -49,8 +49,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty switch (hitObject) { // We want to only consider fruits that contribute to the combo. Droplets are addressed as accuracy and spinners are not relevant for "skill" calculations. - case Fruit _: - difficultyHitObjects.Add(new CatchDifficultyHitObject((CatchHitObject)hitObject, halfCatchWidth)); + case Fruit fruit: + difficultyHitObjects.Add(new CatchDifficultyHitObject(fruit, halfCatchWidth)); break; case JuiceStream _: difficultyHitObjects.AddRange(hitObject.NestedHitObjects.OfType().Where(o => !(o is TinyDroplet)).Select(o => new CatchDifficultyHitObject(o, halfCatchWidth))); diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index 6347cf9da2..cea59c3fea 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -87,8 +87,8 @@ namespace osu.Game.Rulesets.Taiko.Scoring if (obj.IsStrong) AddJudgement(new TaikoStrongHitJudgement()); break; - case DrumRoll _: - for (int i = 0; i < ((DrumRoll)obj).NestedHitObjects.OfType().Count(); i++) + case DrumRoll drumRoll: + for (int i = 0; i < drumRoll.NestedHitObjects.OfType().Count(); i++) { AddJudgement(new TaikoDrumRollTickJudgement { Result = HitResult.Great }); diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index 0c9e03cedd..0de0a620e3 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -71,11 +71,11 @@ namespace osu.Game.Rulesets.Difficulty case 1: yield return currentSet.Single(); break; + default: + yield return new MultiMod(currentSet.ToArray()); + break; } - if (currentSetCount > 1) - yield return new MultiMod(currentSet.ToArray()); - // Apply mods in the adjustment set recursively. Using the entire adjustment set would result in duplicate multi-mod mod // combinations in further recursions, so a moving subset is used to eliminate this effect for (int i = adjustmentSetStart; i < adjustmentSet.Length; i++) From 9b7d01397b7f8aedeadc1866c55d6a261211df19 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 17 Jul 2018 16:53:32 +0900 Subject: [PATCH 129/304] Add ruleset config to HitObjectComposer --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 18a84ccee0..2301620116 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Logging; using osu.Framework.Timing; using osu.Game.Beatmaps; +using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; @@ -25,6 +26,8 @@ namespace osu.Game.Rulesets.Edit protected ICompositionTool CurrentTool { get; private set; } + protected IRulesetConfigManager Config { get; private set; } + protected RulesetContainer RulesetContainer; private readonly List layerContainers = new List(); @@ -115,7 +118,10 @@ namespace osu.Game.Rulesets.Edit protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + dependencies.CacheAs(this); + Config = dependencies.Get().GetConfigFor(ruleset); + return dependencies; } From 54e288f09b8953514b5d28dae5e3d2b4777ff7a8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 17 Jul 2018 16:55:50 +0900 Subject: [PATCH 130/304] Correctly give note masks a scrolling info --- .../Edit/ManiaHitObjectComposer.cs | 12 ++++++++++ .../UI/ManiaRulesetContainer.cs | 19 ++++----------- .../UI/ManiaScrollingInfo.cs | 23 +++++++++++++++++++ 3 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/UI/ManiaScrollingInfo.cs diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index b1968d0aff..f37d8134ce 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -10,16 +10,28 @@ using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Game.Rulesets.Mania.Configuration; +using osu.Game.Rulesets.Mania.UI; namespace osu.Game.Rulesets.Mania.Edit { public class ManiaHitObjectComposer : HitObjectComposer { + protected new ManiaConfigManager Config => (ManiaConfigManager)base.Config; + public ManiaHitObjectComposer(Ruleset ruleset) : base(ruleset) { } + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + { + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + dependencies.CacheAs(new ManiaScrollingInfo(Config)); + return dependencies; + } + protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new ManiaEditRulesetContainer(ruleset, beatmap); protected override IReadOnlyList CompositionTools => new ICompositionTool[] diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index 810a6fad9b..09ebde2799 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Input; @@ -35,9 +34,7 @@ namespace osu.Game.Rulesets.Mania.UI public IEnumerable BarLines; - private readonly Bindable configDirection = new Bindable(); - private ManiaScrollingInfo scrollingInfo; - protected IScrollingInfo ScrollingInfo => scrollingInfo; + protected new ManiaConfigManager Config => (ManiaConfigManager)base.Config; public ManiaRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) @@ -74,9 +71,6 @@ namespace osu.Game.Rulesets.Mania.UI private void load() { BarLines.ForEach(Playfield.Add); - - ((ManiaConfigManager)Config).BindWith(ManiaSetting.ScrollDirection, configDirection); - configDirection.BindValueChanged(d => scrollingInfo.Direction.Value = (ScrollingDirection)d, true); } private DependencyContainer dependencies; @@ -84,7 +78,10 @@ namespace osu.Game.Rulesets.Mania.UI protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - dependencies.CacheAs(scrollingInfo = new ManiaScrollingInfo()); + + if (dependencies.Get() == null) + dependencies.CacheAs(new ManiaScrollingInfo(Config)); + return dependencies; } @@ -116,11 +113,5 @@ namespace osu.Game.Rulesets.Mania.UI protected override Vector2 PlayfieldArea => new Vector2(1, 0.8f); protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new ManiaFramedReplayInputHandler(replay); - - private class ManiaScrollingInfo : IScrollingInfo - { - public readonly Bindable Direction = new Bindable(); - IBindable IScrollingInfo.Direction => Direction; - } } } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaScrollingInfo.cs b/osu.Game.Rulesets.Mania/UI/ManiaScrollingInfo.cs new file mode 100644 index 0000000000..a1cc7cfbc7 --- /dev/null +++ b/osu.Game.Rulesets.Mania/UI/ManiaScrollingInfo.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.Configuration; +using osu.Game.Rulesets.Mania.Configuration; +using osu.Game.Rulesets.UI.Scrolling; + +namespace osu.Game.Rulesets.Mania.UI +{ + public class ManiaScrollingInfo : IScrollingInfo + { + private readonly Bindable configDirection = new Bindable(); + + public readonly Bindable Direction = new Bindable(); + IBindable IScrollingInfo.Direction => Direction; + + public ManiaScrollingInfo(ManiaConfigManager config) + { + config.BindWith(ManiaSetting.ScrollDirection, configDirection); + configDirection.BindValueChanged(v => Direction.Value = (ScrollingDirection)v); + } + } +} From c6816a6cf3f638b5ee031280f6be7b1c9e79c4e9 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 17 Jul 2018 17:00:28 +0900 Subject: [PATCH 131/304] Fix potential quadratic complexity in taiko autoplay --- osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index cea59c3fea..7dd50ab8b8 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -88,7 +88,8 @@ namespace osu.Game.Rulesets.Taiko.Scoring AddJudgement(new TaikoStrongHitJudgement()); break; case DrumRoll drumRoll: - for (int i = 0; i < drumRoll.NestedHitObjects.OfType().Count(); i++) + var count = drumRoll.NestedHitObjects.OfType().Count(); + for (int i = 0; i < count; i++) { AddJudgement(new TaikoDrumRollTickJudgement { Result = HitResult.Great }); From fb09385f5135c187a281bab6b4fc09fb0adcf46c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 11:01:08 +0900 Subject: [PATCH 132/304] Remove net471 targeting --- osu.Desktop/osu.Desktop.csproj | 2 +- .../osu.Game.Rulesets.Catch.Tests.csproj | 2 +- .../osu.Game.Rulesets.Mania.Tests.csproj | 2 +- osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj | 2 +- .../osu.Game.Rulesets.Taiko.Tests.csproj | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 0289db20f0..1d9928134d 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -1,7 +1,7 @@  - net471;netcoreapp2.1 + netcoreapp2.1 WinExe AnyCPU true diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj index 93fa2c4d67..66c81dc14d 100644 --- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj +++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj @@ -2,7 +2,7 @@ WinExe - netcoreapp2.1;net471 + netcoreapp2.1 diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj index 77504fdc3c..7427862c0d 100644 --- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj +++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj @@ -2,7 +2,7 @@ WinExe - netcoreapp2.1;net471 + netcoreapp2.1 diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj index c5d9b26145..0d0e023e2a 100644 --- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj +++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj @@ -2,7 +2,7 @@ WinExe - netcoreapp2.1;net471 + netcoreapp2.1 diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj index dea34d25e7..3c38a48be6 100644 --- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj +++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj @@ -2,7 +2,7 @@ WinExe - netcoreapp2.1;net471 + netcoreapp2.1 diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 532915100b..066df5418a 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -2,7 +2,7 @@ WinExe - netcoreapp2.1;net471 + netcoreapp2.1 From e3fb781a5a712883a83380b2023e2e09f11d4b83 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 12:58:28 +0900 Subject: [PATCH 133/304] Fix ArchiveModelManager's model import method not running import logic --- osu.Game/Beatmaps/BeatmapManager.cs | 3 +- osu.Game/Database/ArchiveModelManager.cs | 42 ++++++++++++-------- osu.Game/Database/SingletonContextFactory.cs | 2 +- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 78042349d1..4ff16b604a 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -91,7 +91,8 @@ namespace osu.Game.Beatmaps protected override void Populate(BeatmapSetInfo model, ArchiveReader archive) { - model.Beatmaps = createBeatmapDifficulties(archive); + if (archive != null) + model.Beatmaps = createBeatmapDifficulties(archive); foreach (BeatmapInfo b in model.Beatmaps) { diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index cbf0df3227..0465c0ad73 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; using osu.Framework.IO.File; using osu.Framework.Logging; @@ -175,7 +176,24 @@ namespace osu.Game.Database /// The archive to be imported. public TModel Import(ArchiveReader archive) { - TModel item = null; + try + { + return Import(CreateModel(archive), archive); + } + catch (Exception e) + { + Logger.Error(e, $"Model creation of {archive.Name} failed.", LoggingTarget.Database); + return null; + } + } + + /// + /// Import an item from a . + /// + /// The model to be imported. + /// An optional archive to use for model population. + public TModel Import(TModel item, ArchiveReader archive = null) + { delayEvents(); try @@ -186,18 +204,16 @@ namespace osu.Game.Database { if (!write.IsTransactionLeader) throw new InvalidOperationException($"Ensure there is no parent transaction so errors can correctly be handled by {this}"); - // create a new model (don't yet add to database) - item = CreateModel(archive); - var existing = CheckForExisting(item); if (existing != null) { - Logger.Log($"Found existing {typeof(TModel)} for {archive.Name} (ID {existing.ID}). Skipping import.", LoggingTarget.Database); + Logger.Log($"Found existing {typeof(TModel)} for {item} (ID {existing.ID}). Skipping import.", LoggingTarget.Database); return existing; } - item.Files = createFileInfos(archive, Files); + if (archive != null) + item.Files = createFileInfos(archive, Files); Populate(item, archive); @@ -211,11 +227,11 @@ namespace osu.Game.Database } } - Logger.Log($"Import of {archive.Name} successfully completed!", LoggingTarget.Database); + Logger.Log($"Import of {item} successfully completed!", LoggingTarget.Database); } catch (Exception e) { - Logger.Error(e, $"Import of {archive.Name} failed and has been rolled back.", LoggingTarget.Database); + Logger.Error(e, $"Import of {item} failed and has been rolled back.", LoggingTarget.Database); item = null; } finally @@ -227,12 +243,6 @@ namespace osu.Game.Database return item; } - /// - /// Import an item from a . - /// - /// The model to be imported. - public void Import(TModel item) => ModelStore.Add(item); - /// /// Perform an update of the specified item. /// TODO: Support file changes. @@ -385,8 +395,8 @@ namespace osu.Game.Database /// After this method, the model should be in a state ready to commit to a store. /// /// The model to populate. - /// The archive to use as a reference for population. - protected virtual void Populate(TModel model, ArchiveReader archive) + /// The archive to use as a reference for population. May be null. + protected virtual void Populate(TModel model, [CanBeNull] ArchiveReader archive) { } diff --git a/osu.Game/Database/SingletonContextFactory.cs b/osu.Game/Database/SingletonContextFactory.cs index ce3fbf6881..a7158c0583 100644 --- a/osu.Game/Database/SingletonContextFactory.cs +++ b/osu.Game/Database/SingletonContextFactory.cs @@ -14,6 +14,6 @@ namespace osu.Game.Database public OsuDbContext Get() => context; - public DatabaseWriteUsage GetForWrite(bool withTransaction = true) => new DatabaseWriteUsage(context, null); + public DatabaseWriteUsage GetForWrite(bool withTransaction = true) => new DatabaseWriteUsage(context, null) { IsTransactionLeader = true }; } } From 5fe634a3b6907db48657fe97e80694ea8d00da48 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 Jul 2018 21:36:33 +0900 Subject: [PATCH 134/304] Click download button to load beatmap --- osu.Game/Overlays/Direct/DownloadButton.cs | 49 ++++++++++++---------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 7758e171c5..99a5881487 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -14,6 +14,7 @@ namespace osu.Game.Overlays.Direct { public class DownloadButton : OsuAnimatedButton { + private readonly BeatmapSetInfo beatmapSet; private readonly SpriteIcon icon; private readonly SpriteIcon checkmark; private readonly BeatmapSetDownloader downloader; @@ -21,11 +22,13 @@ namespace osu.Game.Overlays.Direct private OsuColour colours; - public DownloadButton(BeatmapSetInfo set, bool noVideo = false) + public DownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false) { + this.beatmapSet = beatmapSet; + AddRange(new Drawable[] { - downloader = new BeatmapSetDownloader(set, noVideo), + downloader = new BeatmapSetDownloader(beatmapSet, noVideo), background = new Box { RelativeSizeAxes = Axes.Both, @@ -47,26 +50,6 @@ namespace osu.Game.Overlays.Direct Icon = FontAwesome.fa_check, } }); - - Action = () => - { - if (downloader.DownloadState == BeatmapSetDownloader.DownloadStatus.Downloading) - { - // todo: replace with ShakeContainer after https://github.com/ppy/osu/pull/2909 is merged. - Content.MoveToX(-5, 50, Easing.OutSine).Then() - .MoveToX(5, 100, Easing.InOutSine).Then() - .MoveToX(-5, 100, Easing.InOutSine).Then() - .MoveToX(0, 50, Easing.InSine); - } - else if (downloader.DownloadState == BeatmapSetDownloader.DownloadStatus.Downloaded) - { - // TODO: Jump to song select with this set when the capability is implemented - } - else - { - downloader.Download(); - } - }; } protected override void LoadComplete() @@ -77,9 +60,29 @@ namespace osu.Game.Overlays.Direct } [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuColour colours) + private void load(OsuColour colours, OsuGame game) { this.colours = colours; + + Action = () => + { + switch (downloader.DownloadState.Value) + { + case BeatmapSetDownloader.DownloadStatus.Downloading: + // todo: replace with ShakeContainer after https://github.com/ppy/osu/pull/2909 is merged. + Content.MoveToX(-5, 50, Easing.OutSine).Then() + .MoveToX(5, 100, Easing.InOutSine).Then() + .MoveToX(-5, 100, Easing.InOutSine).Then() + .MoveToX(0, 50, Easing.InSine); + break; + case BeatmapSetDownloader.DownloadStatus.Downloaded: + game.PresentBeatmap(beatmapSet); + break; + default: + downloader.Download(); + break; + } + }; } private void updateState(BeatmapSetDownloader.DownloadStatus state) From f1c3fbe6446c3301d6ba6ef2861aa864367c3a66 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 Jul 2018 22:20:19 +0900 Subject: [PATCH 135/304] Improve integrity of song select bind/change logic --- osu.Game/OsuGame.cs | 8 +++- osu.Game/Screens/Select/FilterControl.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 49 ++++++++++++------------ 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 18a1d018d0..efa211b9d4 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -197,7 +197,13 @@ namespace osu.Game return; } - Beatmap.Value = BeatmapManager.GetWorkingBeatmap(beatmap.Beatmaps.First()); + var databasedSet = BeatmapManager.QueryBeatmapSet(s => s.OnlineBeatmapSetID == beatmap.OnlineBeatmapSetID); + + // Use first beatmap available for current ruleset, else switch ruleset. + var first = databasedSet.Beatmaps.FirstOrDefault(b => b.Ruleset == ruleset.Value) ?? databasedSet.Beatmaps.First(); + + ruleset.Value = first.Ruleset; + Beatmap.Value = BeatmapManager.GetWorkingBeatmap(first); } switch (currentScreen) diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 278d32b2d5..cd86015c65 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -181,7 +181,7 @@ namespace osu.Game.Screens.Select showConverted.ValueChanged += val => updateCriteria(); ruleset.BindTo(parentRuleset); - ruleset.BindValueChanged(val => updateCriteria(), true); + ruleset.BindValueChanged(_ => updateCriteria(), true); } private void updateCriteria() => FilterChanged?.Invoke(CreateCriteria()); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 234508a195..f8ceea2bf3 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -67,7 +67,7 @@ namespace osu.Game.Screens.Select private SampleChannel sampleChangeDifficulty; private SampleChannel sampleChangeBeatmap; - protected new readonly Bindable Ruleset = new Bindable(); + public new readonly Bindable Ruleset = new Bindable(); private DependencyContainer dependencies; @@ -138,7 +138,7 @@ namespace osu.Game.Screens.Select Size = new Vector2(carousel_width, 1), Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - SelectionChanged = updateSelectedBeatmap, + SelectionChanged = b => updateSelectedBeatmap(b, null), BeatmapSetsChanged = carouselBeatmapsLoaded, }, FilterControl = new FilterControl @@ -198,10 +198,6 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader(true)] private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours) { - // manual binding to parent ruleset to allow for delayed load in the incoming direction. - base.Ruleset.ValueChanged += r => updateSelectedBeatmap(beatmapNoDebounce); - Ruleset.ValueChanged += r => base.Ruleset.Value = r; - if (Footer != null) { Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2); @@ -224,15 +220,6 @@ namespace osu.Game.Screens.Select sampleChangeBeatmap = audio.Sample.Get(@"SongSelect/select-expand"); Carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSetsEnumerable(); - - Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true); - Beatmap.BindValueChanged(workingBeatmapChanged); - } - - protected override void LoadComplete() - { - base.LoadComplete(); - base.Ruleset.ValueChanged += r => updateSelectedBeatmap(beatmapNoDebounce); } public void Edit(BeatmapInfo beatmap) @@ -298,15 +285,26 @@ namespace osu.Game.Screens.Select /// /// selection has been changed as the result of a user interaction. /// - private void updateSelectedBeatmap(BeatmapInfo beatmap) + private void updateSelectedBeatmap(BeatmapInfo beatmap, RulesetInfo ruleset) { - var ruleset = base.Ruleset.Value; + if (ruleset == null) ruleset = rulesetNoDebounce; + if (beatmap == null) beatmap = beatmapNoDebounce; void performLoad() { WorkingBeatmap working = Beatmap.Value; + bool preview = false; + if (ruleset?.Equals(Ruleset.Value) != true) + { + Ruleset.Value = ruleset; + + // force a filter before attempting to change the beatmap. + // we may still be in the wrong ruleset as there is a debounce delay on ruleset changes. + Carousel.Filter(null, false); + } + // We may be arriving here due to another component changing the bindable Beatmap. // In these cases, the other component has already loaded the beatmap, so we don't need to do so again. if (beatmap?.Equals(Beatmap.Value.BeatmapInfo) != true) @@ -315,11 +313,9 @@ namespace osu.Game.Screens.Select working = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value); } - working.Mods.Value = Enumerable.Empty(); Beatmap.Value = working; - Ruleset.Value = ruleset; ensurePlayingSelected(preview); @@ -343,10 +339,7 @@ namespace osu.Game.Screens.Select else sampleChangeBeatmap.Play(); - if (beatmap == Beatmap.Value.BeatmapInfo) - performLoad(); - else - selectionChangedDebounce = Scheduler.AddDelayed(performLoad, 200); + selectionChangedDebounce = Scheduler.AddDelayed(performLoad, 200); } } @@ -494,6 +487,14 @@ namespace osu.Game.Screens.Select private void carouselBeatmapsLoaded() { + // manual binding to parent ruleset to allow for delayed load in the incoming direction. + rulesetNoDebounce = Ruleset.Value = base.Ruleset.Value; + base.Ruleset.ValueChanged += r => updateSelectedBeatmap(null, r); + Ruleset.ValueChanged += r => base.Ruleset.Value = r; + + Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true); + Beatmap.BindValueChanged(workingBeatmapChanged); + if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false && Beatmap.Value.BeatmapSetInfo?.Protected == false && Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false)) return; @@ -502,7 +503,7 @@ namespace osu.Game.Screens.Select { // in the case random selection failed, we want to trigger selectionChanged // to show the dummy beatmap (we have nothing else to display). - updateSelectedBeatmap(null); + updateSelectedBeatmap(null, null); } } From 9611292f4ec03e9f58ea4544e2ef0432e2ed0aaa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 10:12:14 +0900 Subject: [PATCH 136/304] FilterTask -> PendingFilter --- osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs | 2 +- osu.Game/Screens/Select/BeatmapCarousel.cs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs b/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs index 6d2b37d981..db66c01814 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs @@ -530,7 +530,7 @@ namespace osu.Game.Tests.Visual { public new List Items => base.Items; - public bool PendingFilterTask => FilterTask != null; + public bool PendingFilterTask => PendingFilter != null; } } } diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 3c9a14e1f4..3430d522ca 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -329,13 +329,13 @@ namespace osu.Game.Screens.Select private FilterCriteria activeCriteria = new FilterCriteria(); - protected ScheduledDelegate FilterTask; + protected ScheduledDelegate PendingFilter; public bool AllowSelection = true; public void FlushPendingFilterOperations() { - if (FilterTask?.Completed == false) + if (PendingFilter?.Completed == false) { applyActiveCriteria(false, false); Update(); @@ -356,18 +356,18 @@ namespace osu.Game.Screens.Select void perform() { - FilterTask = null; + PendingFilter = null; root.Filter(activeCriteria); itemsCache.Invalidate(); if (scroll) scrollPositionCache.Invalidate(); } - FilterTask?.Cancel(); - FilterTask = null; + PendingFilter?.Cancel(); + PendingFilter = null; if (debounce) - FilterTask = Scheduler.AddDelayed(perform, 250); + PendingFilter = Scheduler.AddDelayed(perform, 250); else perform(); } From 90840c93840b9b0c1c71effa3aaa493f676da00a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 12:58:28 +0900 Subject: [PATCH 137/304] Fix ArchiveModelManager's model import method not running import logic --- osu.Game/Beatmaps/BeatmapManager.cs | 3 +- osu.Game/Database/ArchiveModelManager.cs | 42 ++++++++++++-------- osu.Game/Database/SingletonContextFactory.cs | 2 +- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 78042349d1..4ff16b604a 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -91,7 +91,8 @@ namespace osu.Game.Beatmaps protected override void Populate(BeatmapSetInfo model, ArchiveReader archive) { - model.Beatmaps = createBeatmapDifficulties(archive); + if (archive != null) + model.Beatmaps = createBeatmapDifficulties(archive); foreach (BeatmapInfo b in model.Beatmaps) { diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index cbf0df3227..0465c0ad73 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; using osu.Framework.IO.File; using osu.Framework.Logging; @@ -175,7 +176,24 @@ namespace osu.Game.Database /// The archive to be imported. public TModel Import(ArchiveReader archive) { - TModel item = null; + try + { + return Import(CreateModel(archive), archive); + } + catch (Exception e) + { + Logger.Error(e, $"Model creation of {archive.Name} failed.", LoggingTarget.Database); + return null; + } + } + + /// + /// Import an item from a . + /// + /// The model to be imported. + /// An optional archive to use for model population. + public TModel Import(TModel item, ArchiveReader archive = null) + { delayEvents(); try @@ -186,18 +204,16 @@ namespace osu.Game.Database { if (!write.IsTransactionLeader) throw new InvalidOperationException($"Ensure there is no parent transaction so errors can correctly be handled by {this}"); - // create a new model (don't yet add to database) - item = CreateModel(archive); - var existing = CheckForExisting(item); if (existing != null) { - Logger.Log($"Found existing {typeof(TModel)} for {archive.Name} (ID {existing.ID}). Skipping import.", LoggingTarget.Database); + Logger.Log($"Found existing {typeof(TModel)} for {item} (ID {existing.ID}). Skipping import.", LoggingTarget.Database); return existing; } - item.Files = createFileInfos(archive, Files); + if (archive != null) + item.Files = createFileInfos(archive, Files); Populate(item, archive); @@ -211,11 +227,11 @@ namespace osu.Game.Database } } - Logger.Log($"Import of {archive.Name} successfully completed!", LoggingTarget.Database); + Logger.Log($"Import of {item} successfully completed!", LoggingTarget.Database); } catch (Exception e) { - Logger.Error(e, $"Import of {archive.Name} failed and has been rolled back.", LoggingTarget.Database); + Logger.Error(e, $"Import of {item} failed and has been rolled back.", LoggingTarget.Database); item = null; } finally @@ -227,12 +243,6 @@ namespace osu.Game.Database return item; } - /// - /// Import an item from a . - /// - /// The model to be imported. - public void Import(TModel item) => ModelStore.Add(item); - /// /// Perform an update of the specified item. /// TODO: Support file changes. @@ -385,8 +395,8 @@ namespace osu.Game.Database /// After this method, the model should be in a state ready to commit to a store. /// /// The model to populate. - /// The archive to use as a reference for population. - protected virtual void Populate(TModel model, ArchiveReader archive) + /// The archive to use as a reference for population. May be null. + protected virtual void Populate(TModel model, [CanBeNull] ArchiveReader archive) { } diff --git a/osu.Game/Database/SingletonContextFactory.cs b/osu.Game/Database/SingletonContextFactory.cs index ce3fbf6881..a7158c0583 100644 --- a/osu.Game/Database/SingletonContextFactory.cs +++ b/osu.Game/Database/SingletonContextFactory.cs @@ -14,6 +14,6 @@ namespace osu.Game.Database public OsuDbContext Get() => context; - public DatabaseWriteUsage GetForWrite(bool withTransaction = true) => new DatabaseWriteUsage(context, null); + public DatabaseWriteUsage GetForWrite(bool withTransaction = true) => new DatabaseWriteUsage(context, null) { IsTransactionLeader = true }; } } From 1d52231d4fb1ad53e3052c93c09138b5fe7c86cd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 16:43:46 +0900 Subject: [PATCH 138/304] Remove SingletonContextFactory It is dangerous to use this as it doesn't correctly handle contexts and can cause issues that will never actually arise in normal execution. --- .../Visual/TestCasePlaySongSelect.cs | 7 ++++++- osu.Game/Database/DatabaseContextFactory.cs | 10 +++++----- osu.Game/Database/SingletonContextFactory.cs | 19 ------------------- osu.Game/OsuGameBase.cs | 2 +- osu.Game/Tests/Platform/TestStorage.cs | 8 +++----- 5 files changed, 15 insertions(+), 31 deletions(-) delete mode 100644 osu.Game/Database/SingletonContextFactory.cs diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index dab7f7e037..4afb76a7e2 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -62,7 +62,12 @@ namespace osu.Game.Tests.Visual var storage = new TestStorage(@"TestCasePlaySongSelect"); // this is by no means clean. should be replacing inside of OsuGameBase somehow. - IDatabaseContextFactory factory = new SingletonContextFactory(new OsuDbContext()); + DatabaseContextFactory factory = new DatabaseContextFactory(storage); + + factory.ResetDatabase(); + + using (var usage = factory.Get()) + usage.Migrate(); Dependencies.Cache(rulesets = new RulesetStore(factory)); Dependencies.Cache(manager = new BeatmapManager(storage, factory, rulesets, null, null) diff --git a/osu.Game/Database/DatabaseContextFactory.cs b/osu.Game/Database/DatabaseContextFactory.cs index 5160239c38..c20d4569f6 100644 --- a/osu.Game/Database/DatabaseContextFactory.cs +++ b/osu.Game/Database/DatabaseContextFactory.cs @@ -11,7 +11,7 @@ namespace osu.Game.Database { public class DatabaseContextFactory : IDatabaseContextFactory { - private readonly GameHost host; + private readonly Storage storage; private const string database_name = @"client"; @@ -26,9 +26,9 @@ namespace osu.Game.Database private IDbContextTransaction currentWriteTransaction; - public DatabaseContextFactory(GameHost host) + public DatabaseContextFactory(Storage storage) { - this.host = host; + this.storage = storage; recycleThreadContexts(); } @@ -117,7 +117,7 @@ namespace osu.Game.Database private void recycleThreadContexts() => threadContexts = new ThreadLocal(CreateContext); - protected virtual OsuDbContext CreateContext() => new OsuDbContext(host.Storage.GetDatabaseConnectionString(database_name)) + protected virtual OsuDbContext CreateContext() => new OsuDbContext(storage.GetDatabaseConnectionString(database_name)) { Database = { AutoTransactionsEnabled = false } }; @@ -129,7 +129,7 @@ namespace osu.Game.Database recycleThreadContexts(); GC.Collect(); GC.WaitForPendingFinalizers(); - host.Storage.DeleteDatabase(database_name); + storage.DeleteDatabase(database_name); } } } diff --git a/osu.Game/Database/SingletonContextFactory.cs b/osu.Game/Database/SingletonContextFactory.cs deleted file mode 100644 index a7158c0583..0000000000 --- a/osu.Game/Database/SingletonContextFactory.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Database -{ - public class SingletonContextFactory : IDatabaseContextFactory - { - private readonly OsuDbContext context; - - public SingletonContextFactory(OsuDbContext context) - { - this.context = context; - } - - public OsuDbContext Get() => context; - - public DatabaseWriteUsage GetForWrite(bool withTransaction = true) => new DatabaseWriteUsage(context, null) { IsTransactionLeader = true }; - } -} diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index a9b74d6740..63cc883844 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -107,7 +107,7 @@ namespace osu.Game { Resources.AddStore(new DllResourceStore(@"osu.Game.Resources.dll")); - dependencies.Cache(contextFactory = new DatabaseContextFactory(Host)); + dependencies.Cache(contextFactory = new DatabaseContextFactory(Host.Storage)); dependencies.Cache(new LargeTextureStore(new RawTextureLoaderStore(new NamespacedResourceStore(Resources, @"Textures")))); diff --git a/osu.Game/Tests/Platform/TestStorage.cs b/osu.Game/Tests/Platform/TestStorage.cs index 5b31c7b4d0..a6b6b5530d 100644 --- a/osu.Game/Tests/Platform/TestStorage.cs +++ b/osu.Game/Tests/Platform/TestStorage.cs @@ -7,13 +7,11 @@ namespace osu.Game.Tests.Platform { public class TestStorage : DesktopStorage { - public TestStorage(string baseName) : base(baseName, null) + public TestStorage(string baseName) + : base(baseName, null) { } - public override string GetDatabaseConnectionString(string name) - { - return "DataSource=:memory:"; - } + public override string GetDatabaseConnectionString(string name) => "Data Source=" + GetUsablePathFor($"{(object)name}.db", true); } } From 0c242443400529b107b567c318198210f2a846f6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 16:43:46 +0900 Subject: [PATCH 139/304] Remove SingletonContextFactory It is dangerous to use this as it doesn't correctly handle contexts and can cause issues that will never actually arise in normal execution. # Conflicts: # osu.Game/Database/SingletonContextFactory.cs --- .../Visual/TestCasePlaySongSelect.cs | 7 ++++++- osu.Game/Database/DatabaseContextFactory.cs | 10 +++++----- osu.Game/Database/SingletonContextFactory.cs | 19 ------------------- osu.Game/OsuGameBase.cs | 2 +- osu.Game/Tests/Platform/TestStorage.cs | 8 +++----- 5 files changed, 15 insertions(+), 31 deletions(-) delete mode 100644 osu.Game/Database/SingletonContextFactory.cs diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index dab7f7e037..4afb76a7e2 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -62,7 +62,12 @@ namespace osu.Game.Tests.Visual var storage = new TestStorage(@"TestCasePlaySongSelect"); // this is by no means clean. should be replacing inside of OsuGameBase somehow. - IDatabaseContextFactory factory = new SingletonContextFactory(new OsuDbContext()); + DatabaseContextFactory factory = new DatabaseContextFactory(storage); + + factory.ResetDatabase(); + + using (var usage = factory.Get()) + usage.Migrate(); Dependencies.Cache(rulesets = new RulesetStore(factory)); Dependencies.Cache(manager = new BeatmapManager(storage, factory, rulesets, null, null) diff --git a/osu.Game/Database/DatabaseContextFactory.cs b/osu.Game/Database/DatabaseContextFactory.cs index 5160239c38..c20d4569f6 100644 --- a/osu.Game/Database/DatabaseContextFactory.cs +++ b/osu.Game/Database/DatabaseContextFactory.cs @@ -11,7 +11,7 @@ namespace osu.Game.Database { public class DatabaseContextFactory : IDatabaseContextFactory { - private readonly GameHost host; + private readonly Storage storage; private const string database_name = @"client"; @@ -26,9 +26,9 @@ namespace osu.Game.Database private IDbContextTransaction currentWriteTransaction; - public DatabaseContextFactory(GameHost host) + public DatabaseContextFactory(Storage storage) { - this.host = host; + this.storage = storage; recycleThreadContexts(); } @@ -117,7 +117,7 @@ namespace osu.Game.Database private void recycleThreadContexts() => threadContexts = new ThreadLocal(CreateContext); - protected virtual OsuDbContext CreateContext() => new OsuDbContext(host.Storage.GetDatabaseConnectionString(database_name)) + protected virtual OsuDbContext CreateContext() => new OsuDbContext(storage.GetDatabaseConnectionString(database_name)) { Database = { AutoTransactionsEnabled = false } }; @@ -129,7 +129,7 @@ namespace osu.Game.Database recycleThreadContexts(); GC.Collect(); GC.WaitForPendingFinalizers(); - host.Storage.DeleteDatabase(database_name); + storage.DeleteDatabase(database_name); } } } diff --git a/osu.Game/Database/SingletonContextFactory.cs b/osu.Game/Database/SingletonContextFactory.cs deleted file mode 100644 index ce3fbf6881..0000000000 --- a/osu.Game/Database/SingletonContextFactory.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Database -{ - public class SingletonContextFactory : IDatabaseContextFactory - { - private readonly OsuDbContext context; - - public SingletonContextFactory(OsuDbContext context) - { - this.context = context; - } - - public OsuDbContext Get() => context; - - public DatabaseWriteUsage GetForWrite(bool withTransaction = true) => new DatabaseWriteUsage(context, null); - } -} diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index a9b74d6740..63cc883844 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -107,7 +107,7 @@ namespace osu.Game { Resources.AddStore(new DllResourceStore(@"osu.Game.Resources.dll")); - dependencies.Cache(contextFactory = new DatabaseContextFactory(Host)); + dependencies.Cache(contextFactory = new DatabaseContextFactory(Host.Storage)); dependencies.Cache(new LargeTextureStore(new RawTextureLoaderStore(new NamespacedResourceStore(Resources, @"Textures")))); diff --git a/osu.Game/Tests/Platform/TestStorage.cs b/osu.Game/Tests/Platform/TestStorage.cs index 5b31c7b4d0..a6b6b5530d 100644 --- a/osu.Game/Tests/Platform/TestStorage.cs +++ b/osu.Game/Tests/Platform/TestStorage.cs @@ -7,13 +7,11 @@ namespace osu.Game.Tests.Platform { public class TestStorage : DesktopStorage { - public TestStorage(string baseName) : base(baseName, null) + public TestStorage(string baseName) + : base(baseName, null) { } - public override string GetDatabaseConnectionString(string name) - { - return "DataSource=:memory:"; - } + public override string GetDatabaseConnectionString(string name) => "Data Source=" + GetUsablePathFor($"{(object)name}.db", true); } } From 6254f4e0f7c584105c4c774d29a5822bf31fe9a9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 18:00:04 +0900 Subject: [PATCH 140/304] Fix tests --- appveyor.yml | 2 -- osu.TestProject.props | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 7c08eb9e9c..27f1484e32 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,8 +13,6 @@ install: before_build: - cmd: CodeFileSanity.exe - cmd: nuget restore -verbosity quiet -environment: - TargetFramework: net471 build: project: osu.sln parallel: true diff --git a/osu.TestProject.props b/osu.TestProject.props index c2e6048a60..1369af4aee 100644 --- a/osu.TestProject.props +++ b/osu.TestProject.props @@ -16,6 +16,7 @@ + From ffd3040fe2da3de865f3b28b9e10c43a9835144d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 Jul 2018 14:41:07 +0900 Subject: [PATCH 141/304] Fix GameplayCursor state not restoring correctly after Show/Hide --- osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs index 35146dfe29..4d6722b61b 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs @@ -39,6 +39,11 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor private int downCount; + private const float pressed_scale = 1.2f; + private const float released_scale = 1f; + + private float targetScale => downCount > 0 ? pressed_scale : released_scale; + public bool OnPressed(OsuAction action) { switch (action) @@ -46,7 +51,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor case OsuAction.LeftButton: case OsuAction.RightButton: downCount++; - ActiveCursor.ScaleTo(1).ScaleTo(1.2f, 100, Easing.OutQuad); + ActiveCursor.ScaleTo(released_scale).ScaleTo(targetScale, 100, Easing.OutQuad); break; } @@ -60,7 +65,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor case OsuAction.LeftButton: case OsuAction.RightButton: if (--downCount == 0) - ActiveCursor.ScaleTo(1, 200, Easing.OutQuad); + ActiveCursor.ScaleTo(targetScale, 200, Easing.OutQuad); break; } @@ -72,13 +77,13 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor protected override void PopIn() { fadeContainer.FadeTo(1, 300, Easing.OutQuint); - ActiveCursor.ScaleTo(1, 400, Easing.OutQuint); + ActiveCursor.ScaleTo(targetScale, 400, Easing.OutQuint); } protected override void PopOut() { fadeContainer.FadeTo(0.05f, 450, Easing.OutQuint); - ActiveCursor.ScaleTo(0.8f, 450, Easing.OutQuint); + ActiveCursor.ScaleTo(targetScale * 0.8f, 450, Easing.OutQuint); } public class OsuCursor : Container From c2cdf12986a1e879a700b4a411b345df8a3f92ed Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 17:01:27 +0900 Subject: [PATCH 142/304] Better pause logic --- osu.Game/Rulesets/UI/RulesetContainer.cs | 13 +++++++++++++ osu.Game/Screens/Play/PauseContainer.cs | 12 ++++-------- osu.Game/Screens/Play/Player.cs | 8 ++------ 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index d68afdfedc..ee34e2df04 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -89,6 +89,14 @@ namespace osu.Game.Rulesets.UI Ruleset = ruleset; playfield = new Lazy(CreatePlayfield); + IsPaused.ValueChanged += paused => + { + if (HasReplayLoaded) + return; + + KeyBindingInputManager.UseParentInput = !paused; + }; + Cursor = CreateCursor(); } @@ -120,6 +128,11 @@ namespace osu.Game.Rulesets.UI public Replay Replay { get; private set; } + /// + /// Whether the game is paused. Used to block user input. + /// + public readonly BindableBool IsPaused = new BindableBool(); + /// /// Sets a replay to be used, overriding local input. /// diff --git a/osu.Game/Screens/Play/PauseContainer.cs b/osu.Game/Screens/Play/PauseContainer.cs index e2f133dde3..d9677e5daf 100644 --- a/osu.Game/Screens/Play/PauseContainer.cs +++ b/osu.Game/Screens/Play/PauseContainer.cs @@ -4,6 +4,7 @@ using System; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Timing; @@ -18,7 +19,7 @@ namespace osu.Game.Screens.Play /// public class PauseContainer : Container { - public bool IsPaused { get; private set; } + public readonly BindableBool IsPaused = new BindableBool(); public Func CheckCanPause; @@ -39,9 +40,6 @@ namespace osu.Game.Screens.Play public Action OnRetry; public Action OnQuit; - public Action OnResume; - public Action OnPause; - private readonly FramedClock framedClock; private readonly DecoupleableInterpolatingFramedClock decoupledClock; @@ -84,9 +82,8 @@ namespace osu.Game.Screens.Play // stop the seekable clock (stops the audio eventually) decoupledClock.Stop(); - IsPaused = true; + IsPaused.Value = true; - OnPause?.Invoke(); pauseOverlay.Show(); lastPauseActionTime = Time.Current; @@ -96,7 +93,7 @@ namespace osu.Game.Screens.Play { if (!IsPaused) return; - IsPaused = false; + IsPaused.Value = false; IsResuming = false; lastPauseActionTime = Time.Current; @@ -105,7 +102,6 @@ namespace osu.Game.Screens.Play decoupledClock.Seek(decoupledClock.CurrentTime); decoupledClock.Start(); - OnResume?.Invoke(); pauseOverlay.Hide(); } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index fc439a48c5..e92805bf57 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -165,12 +165,6 @@ namespace osu.Game.Screens.Play OnRetry = Restart, OnQuit = Exit, CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded, - OnPause = () => - { - pauseContainer.Retries = RestartCount; - hudOverlay.KeyCounter.IsCounting = !pauseContainer.IsPaused; - }, - OnResume = () => hudOverlay.KeyCounter.IsCounting = true, Children = new[] { storyboardContainer = new Container @@ -227,6 +221,8 @@ namespace osu.Game.Screens.Play hudOverlay.HoldToQuit.Action = Exit; hudOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded); + RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused); + if (ShowStoryboard) initializeStoryboard(false); From a01361f8334f0bf2cfdfb4c76a7abf38f7a46428 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 22:05:24 +0900 Subject: [PATCH 143/304] Set restart count --- osu.Game/Screens/Play/Player.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e92805bf57..f28ddb09a2 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -162,6 +162,7 @@ namespace osu.Game.Screens.Play { pauseContainer = new PauseContainer(offsetClock, adjustableClock) { + Retries = RestartCount, OnRetry = Restart, OnQuit = Exit, CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded, From 8414fe9d05ff2e948a25e6e46d551bc0d4a92a21 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 22:19:32 +0900 Subject: [PATCH 144/304] Add key counter exceptions for paused state --- osu.Game/Screens/Play/Player.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index f28ddb09a2..28ae77a53c 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -223,6 +223,7 @@ namespace osu.Game.Screens.Play hudOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded); RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused); + RulesetContainer.IsPaused.ValueChanged += paused => hudOverlay.KeyCounter.IsCounting = !paused; if (ShowStoryboard) initializeStoryboard(false); From 41441771ae2d4cb0bc95ecceef32b3a8d2b19593 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 22:22:28 +0900 Subject: [PATCH 145/304] Remove unnecessary cast --- osu.Game/Tests/Platform/TestStorage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Tests/Platform/TestStorage.cs b/osu.Game/Tests/Platform/TestStorage.cs index a6b6b5530d..8391de3405 100644 --- a/osu.Game/Tests/Platform/TestStorage.cs +++ b/osu.Game/Tests/Platform/TestStorage.cs @@ -12,6 +12,6 @@ namespace osu.Game.Tests.Platform { } - public override string GetDatabaseConnectionString(string name) => "Data Source=" + GetUsablePathFor($"{(object)name}.db", true); + public override string GetDatabaseConnectionString(string name) => "Data Source=" + GetUsablePathFor($"{name}.db", true); } } From 82ddbb3f5d1126cb570110e9226d3498fd7668f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 Jul 2018 01:18:07 +0900 Subject: [PATCH 146/304] Delay key count stop --- osu.Game/Screens/Play/Player.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 28ae77a53c..427519bff8 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -223,7 +223,9 @@ namespace osu.Game.Screens.Play hudOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded); RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused); - RulesetContainer.IsPaused.ValueChanged += paused => hudOverlay.KeyCounter.IsCounting = !paused; + + // schedule to ensure we count any key presses from the current frame (which may affect gameplay). + RulesetContainer.IsPaused.ValueChanged += paused => Schedule(() => hudOverlay.KeyCounter.IsCounting = !paused); if (ShowStoryboard) initializeStoryboard(false); From 3e738c607af11c868070c0c13a263cfcb8736bf8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 12:58:45 +0900 Subject: [PATCH 147/304] Add more song select tests --- .../Visual/TestCasePlaySongSelect.cs | 139 +++++++++--------- 1 file changed, 72 insertions(+), 67 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 4afb76a7e2..b73cf5bbd3 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -54,11 +54,11 @@ namespace osu.Game.Tests.Visual public new BeatmapCarousel Carousel => base.Carousel; } + private TestSongSelect songSelect; + [BackgroundDependencyLoader] private void load() { - TestSongSelect songSelect = null; - var storage = new TestStorage(@"TestCasePlaySongSelect"); // this is by no means clean. should be replacing inside of OsuGameBase somehow. @@ -75,42 +75,36 @@ namespace osu.Game.Tests.Visual DefaultBeatmap = defaultBeatmap = Beatmap.Default }); - void loadNewSongSelect(bool deleteMaps = false) => AddStep("reload song select", () => - { - if (deleteMaps) - { - manager.Delete(manager.GetAllUsableBeatmapSets()); - Beatmap.SetDefault(); - } + Beatmap.SetDefault(); + } - if (songSelect != null) - { - Remove(songSelect); - songSelect.Dispose(); - } + [SetUp] + public virtual void SetUp() + { + manager?.Delete(manager.GetAllUsableBeatmapSets()); - Add(songSelect = new TestSongSelect()); - }); - - loadNewSongSelect(true); - - AddWaitStep(3); + Child = songSelect = new TestSongSelect(); + } + [Test] + public void TestDummy() + { AddAssert("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap); AddAssert("dummy shown on wedge", () => songSelect.CurrentBeatmapDetailsBeatmap == defaultBeatmap); - AddStep("import test maps", () => - { - for (int i = 0; i < 100; i += 10) - manager.Import(createTestBeatmapSet(i)); - }); - + addManyTestMaps(); AddWaitStep(3); + AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); + } - loadNewSongSelect(); + [Test] + public void TestSorting() + { + addManyTestMaps(); AddWaitStep(3); + AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; }); @@ -119,55 +113,66 @@ namespace osu.Game.Tests.Visual AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; }); } - private BeatmapSetInfo createTestBeatmapSet(int i) + [Test] + public void TestRulesetChange() { + AddStep("import test maps", () => + { + manager.Import(createTestBeatmapSet(0, rulesets.AvailableRulesets.Where(r => r.ID == 0).ToArray())); + manager.Import(createTestBeatmapSet(1, rulesets.AvailableRulesets.Where(r => r.ID == 0).ToArray())); + }); + } + + private void addManyTestMaps() + { + AddStep("import test maps", () => + { + var usableRulesets = rulesets.AvailableRulesets.Where(r => r.ID != 2).ToArray(); + + for (int i = 0; i < 100; i += 10) + manager.Import(createTestBeatmapSet(i, usableRulesets)); + }); + } + + private BeatmapSetInfo createTestBeatmapSet(int idOffset, RulesetInfo[] rulesets) + { + int j = 0; + RulesetInfo getRuleset() => rulesets[j++ % rulesets.Length]; + + var beatmaps = new List(); + + int setId = 1234 + idOffset; + + for (int i = 0; i < 6; i++) + { + int beatmapId = 1234 + idOffset + i; + + beatmaps.Add(new BeatmapInfo + { + Ruleset = getRuleset(), + OnlineBeatmapID = beatmapId, + Path = "normal.osu", + Version = $"{beatmapId}", + BaseDifficulty = new BeatmapDifficulty + { + OverallDifficulty = 3.5f, + } + }); + } + + return new BeatmapSetInfo { - OnlineBeatmapSetID = 1234 + i, + OnlineBeatmapSetID = setId, Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(), Metadata = new BeatmapMetadata { // Create random metadata, then we can check if sorting works based on these - Artist = "MONACA " + RNG.Next(0, 9), - Title = "Black Song " + RNG.Next(0, 9), + Artist = "Some Artist " + RNG.Next(0, 9), + Title = $"Some Song (set id {setId})", AuthorString = "Some Guy " + RNG.Next(0, 9), }, - Beatmaps = new List(new[] - { - new BeatmapInfo - { - OnlineBeatmapID = 1234 + i, - Ruleset = rulesets.AvailableRulesets.First(), - Path = "normal.osu", - Version = "Normal", - BaseDifficulty = new BeatmapDifficulty - { - OverallDifficulty = 3.5f, - } - }, - new BeatmapInfo - { - OnlineBeatmapID = 1235 + i, - Ruleset = rulesets.AvailableRulesets.First(), - Path = "hard.osu", - Version = "Hard", - BaseDifficulty = new BeatmapDifficulty - { - OverallDifficulty = 5, - } - }, - new BeatmapInfo - { - OnlineBeatmapID = 1236 + i, - Ruleset = rulesets.AvailableRulesets.First(), - Path = "insane.osu", - Version = "Insane", - BaseDifficulty = new BeatmapDifficulty - { - OverallDifficulty = 7, - } - }, - }), + Beatmaps = beatmaps }; } } From 68614f1512e2becfb23b2845e90265a1d54540e2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 Jul 2018 13:41:09 +0900 Subject: [PATCH 148/304] Ensure online IDs are validated for imports that don't have an associated archive too --- osu.Game/Beatmaps/BeatmapManager.cs | 73 ++++++++++++----------------- 1 file changed, 30 insertions(+), 43 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 4ff16b604a..3bd5c440c1 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -89,34 +89,46 @@ namespace osu.Game.Beatmaps this.audioManager = audioManager; } - protected override void Populate(BeatmapSetInfo model, ArchiveReader archive) + protected override void Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive) { if (archive != null) - model.Beatmaps = createBeatmapDifficulties(archive); + beatmapSet.Beatmaps = createBeatmapDifficulties(archive); - foreach (BeatmapInfo b in model.Beatmaps) + foreach (BeatmapInfo b in beatmapSet.Beatmaps) { // remove metadata from difficulties where it matches the set - if (model.Metadata.Equals(b.Metadata)) + if (beatmapSet.Metadata.Equals(b.Metadata)) b.Metadata = null; - // by setting the model here, we can update the noline set id below. - b.BeatmapSet = model; - - fetchAndPopulateOnlineIDs(b, model.Beatmaps); + b.BeatmapSet = beatmapSet; } // check if a set already exists with the same online id, delete if it does. - if (model.OnlineBeatmapSetID != null) + if (beatmapSet.OnlineBeatmapSetID != null) { - var existingOnlineId = beatmaps.ConsumableItems.FirstOrDefault(b => b.OnlineBeatmapSetID == model.OnlineBeatmapSetID); + var existingOnlineId = beatmaps.ConsumableItems.FirstOrDefault(b => b.OnlineBeatmapSetID == beatmapSet.OnlineBeatmapSetID); if (existingOnlineId != null) { Delete(existingOnlineId); beatmaps.PurgeDeletable(s => s.ID == existingOnlineId.ID); - Logger.Log($"Found existing beatmap set with same OnlineBeatmapSetID ({model.OnlineBeatmapSetID}). It has been purged.", LoggingTarget.Database); + Logger.Log($"Found existing beatmap set with same OnlineBeatmapSetID ({beatmapSet.OnlineBeatmapSetID}). It has been purged.", LoggingTarget.Database); } } + + validateOnlineIds(beatmapSet.Beatmaps); + + foreach (BeatmapInfo b in beatmapSet.Beatmaps) + fetchAndPopulateOnlineIDs(b, beatmapSet.Beatmaps); + } + + private void validateOnlineIds(List beatmaps) + { + var beatmapIds = beatmaps.Where(b => b.OnlineBeatmapID.HasValue).Select(b => b.OnlineBeatmapID); + + // ensure all IDs are unique in this set and none match existing IDs in the local beatmap store. + if (beatmapIds.GroupBy(b => b).Any(g => g.Count() > 1) || QueryBeatmaps(b => beatmapIds.Contains(b.OnlineBeatmapID)).Any()) + // remove all online IDs if any problems were found. + beatmaps.ForEach(b => b.OnlineBeatmapID = null); } protected override BeatmapSetInfo CheckForExisting(BeatmapSetInfo model) @@ -297,7 +309,7 @@ namespace osu.Game.Beatmaps /// /// The query. /// Results from the provided query. - public IEnumerable QueryBeatmaps(Expression> query) => beatmaps.Beatmaps.AsNoTracking().Where(query); + public IQueryable QueryBeatmaps(Expression> query) => beatmaps.Beatmaps.AsNoTracking().Where(query); /// /// Denotes whether an osu-stable installation is present to perform automated imports from. @@ -360,8 +372,6 @@ namespace osu.Game.Beatmaps { var beatmapInfos = new List(); - bool invalidateOnlineIDs = false; - foreach (var name in reader.Filenames.Where(f => f.EndsWith(".osu"))) { using (var raw = reader.GetStream(name)) @@ -378,38 +388,15 @@ namespace osu.Game.Beatmaps beatmap.BeatmapInfo.Hash = ms.ComputeSHA2Hash(); beatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash(); - if (beatmap.BeatmapInfo.OnlineBeatmapID.HasValue) - { - var ourId = beatmap.BeatmapInfo.OnlineBeatmapID; - - // check that no existing beatmap in database exists that is imported with the same online beatmap ID. if so, give it precedence. - if (QueryBeatmap(b => b.OnlineBeatmapID.Value == ourId) != null) - beatmap.BeatmapInfo.OnlineBeatmapID = null; - - // check that no other beatmap in this imported set has a conflicting online beatmap ID. If so, presume *all* are incorrect. - if (beatmapInfos.Any(b => b.OnlineBeatmapID == ourId)) - invalidateOnlineIDs = true; - } - - RulesetInfo ruleset = rulesets.GetRuleset(beatmap.BeatmapInfo.RulesetID); - + var ruleset = rulesets.GetRuleset(beatmap.BeatmapInfo.RulesetID); beatmap.BeatmapInfo.Ruleset = ruleset; - - if (ruleset != null) - { - // TODO: this should be done in a better place once we actually need to dynamically update it. - beatmap.BeatmapInfo.StarDifficulty = ruleset.CreateInstance().CreateDifficultyCalculator(new DummyConversionBeatmap(beatmap)).Calculate().StarRating; - } - else - beatmap.BeatmapInfo.StarDifficulty = 0; + // TODO: this should be done in a better place once we actually need to dynamically update it. + beatmap.BeatmapInfo.StarDifficulty = ruleset?.CreateInstance().CreateDifficultyCalculator(new DummyConversionBeatmap(beatmap)).Calculate().StarRating ?? 0; beatmapInfos.Add(beatmap.BeatmapInfo); } } - if (invalidateOnlineIDs) - beatmapInfos.ForEach(b => b.OnlineBeatmapID = null); - return beatmapInfos; } @@ -422,12 +409,12 @@ namespace osu.Game.Beatmaps /// True if population was successful. private bool fetchAndPopulateOnlineIDs(BeatmapInfo beatmap, IEnumerable otherBeatmaps, bool force = false) { + if (api?.State != APIState.Online) + return false; + if (!force && beatmap.OnlineBeatmapID != null && beatmap.BeatmapSet.OnlineBeatmapSetID != null) return true; - if (api.State != APIState.Online) - return false; - Logger.Log("Attempting online lookup for IDs...", LoggingTarget.Database); try From 7be3a5d466bafa64a4e462a5c1ec0ca70f6d5d7b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 Jul 2018 14:07:55 +0900 Subject: [PATCH 149/304] Centralise test storage logic --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 10 +++------- osu.Game/Tests/Platform/TestStorage.cs | 17 ----------------- osu.Game/Tests/Visual/OsuTestCase.cs | 13 +++++++++++++ 3 files changed, 16 insertions(+), 24 deletions(-) delete mode 100644 osu.Game/Tests/Platform/TestStorage.cs diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 4afb76a7e2..b94fb42bf0 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -16,7 +16,6 @@ using osu.Game.Rulesets; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Carousel; using osu.Game.Screens.Select.Filter; -using osu.Game.Tests.Platform; namespace osu.Game.Tests.Visual { @@ -28,6 +27,7 @@ namespace osu.Game.Tests.Visual private RulesetStore rulesets; private WorkingBeatmap defaultBeatmap; + private DatabaseContextFactory factory; public override IReadOnlyList RequiredTypes => new[] { @@ -59,18 +59,14 @@ namespace osu.Game.Tests.Visual { TestSongSelect songSelect = null; - var storage = new TestStorage(@"TestCasePlaySongSelect"); - - // this is by no means clean. should be replacing inside of OsuGameBase somehow. - DatabaseContextFactory factory = new DatabaseContextFactory(storage); - + factory = new DatabaseContextFactory(LocalStorage); factory.ResetDatabase(); using (var usage = factory.Get()) usage.Migrate(); Dependencies.Cache(rulesets = new RulesetStore(factory)); - Dependencies.Cache(manager = new BeatmapManager(storage, factory, rulesets, null, null) + Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, null) { DefaultBeatmap = defaultBeatmap = Beatmap.Default }); diff --git a/osu.Game/Tests/Platform/TestStorage.cs b/osu.Game/Tests/Platform/TestStorage.cs deleted file mode 100644 index 8391de3405..0000000000 --- a/osu.Game/Tests/Platform/TestStorage.cs +++ /dev/null @@ -1,17 +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.Platform; - -namespace osu.Game.Tests.Platform -{ - public class TestStorage : DesktopStorage - { - public TestStorage(string baseName) - : base(baseName, null) - { - } - - public override string GetDatabaseConnectionString(string name) => "Data Source=" + GetUsablePathFor($"{name}.db", true); - } -} diff --git a/osu.Game/Tests/Visual/OsuTestCase.cs b/osu.Game/Tests/Visual/OsuTestCase.cs index fcbab5b8f5..8e09ec849c 100644 --- a/osu.Game/Tests/Visual/OsuTestCase.cs +++ b/osu.Game/Tests/Visual/OsuTestCase.cs @@ -1,10 +1,12 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Configuration; +using osu.Framework.Platform; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Rulesets; @@ -20,6 +22,9 @@ namespace osu.Game.Tests.Visual protected DependencyContainer Dependencies { get; private set; } + private readonly Lazy localStorage; + protected Storage LocalStorage => localStorage.Value; + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { Dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); @@ -33,6 +38,11 @@ namespace osu.Game.Tests.Visual return Dependencies; } + protected OsuTestCase() + { + localStorage = new Lazy(() => new DesktopStorage($"{GetType().Name}-{Guid.NewGuid()}", null)); + } + [BackgroundDependencyLoader] private void load(AudioManager audioManager, RulesetStore rulesets) { @@ -50,6 +60,9 @@ namespace osu.Game.Tests.Visual beatmap.Disabled = true; beatmap.Value.Track.Stop(); } + + if (localStorage.IsValueCreated) + localStorage.Value.DeleteDirectory("."); } protected override ITestCaseTestRunner CreateRunner() => new OsuTestCaseTestRunner(); From b7721edc80d1620b49be12956bfcc767aaf61403 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 19 Jul 2018 17:04:51 +0900 Subject: [PATCH 150/304] Remove more unnecessary changes --- .../Layers/Selection/Overlays/HoldNoteMask.cs | 4 --- .../Layers/Selection/Overlays/NoteMask.cs | 2 -- .../Edit/ManiaEditPlayfield.cs | 5 --- .../Edit/ManiaEditRulesetContainer.cs | 3 -- .../Edit/ManiaEditStage.cs | 16 --------- .../Objects/ManiaHitObject.cs | 34 ++----------------- .../Objects/Types/IHasColumn.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 27 ++------------- osu.Game.Rulesets.Mania/UI/ManiaStage.cs | 4 +-- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 31 +++++++---------- osu.Game/Rulesets/Edit/HitObjectMask.cs | 22 +----------- .../Edit/Tools/HitObjectCompositionTool.cs | 11 ++---- .../Rulesets/Edit/Types/IHasEditableColumn.cs | 12 ------- .../Compose/Layers/HitObjectMaskLayer.cs | 2 -- .../Screens/Compose/Layers/MaskContainer.cs | 16 --------- .../Screens/Compose/Layers/MaskSelection.cs | 10 ------ 16 files changed, 22 insertions(+), 179 deletions(-) delete mode 100644 osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs rename {osu.Game/Rulesets => osu.Game.Rulesets.Mania}/Objects/Types/IHasColumn.cs (90%) delete mode 100644 osu.Game/Rulesets/Edit/Types/IHasEditableColumn.cs diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs index 648ec29e64..d0faea564c 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -18,8 +18,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays public HoldNoteMask(DrawableHoldNote hold) : base(hold) { - var holdObject = hold.HitObject; - InternalChildren = new Drawable[] { new HoldNoteNoteMask(hold.Head), @@ -29,8 +27,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays AccentColour = Color4.Transparent }, }; - - holdObject.ColumnChanged += _ => Position = hold.Position; } [BackgroundDependencyLoader] diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs index 8c46e20835..78f876cb14 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs @@ -20,8 +20,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays Masking = true; AddInternal(new NotePiece()); - - note.HitObject.ColumnChanged += _ => Position = note.Position; } [BackgroundDependencyLoader] diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs index 30ff591359..e7bc526471 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs @@ -9,14 +9,9 @@ namespace osu.Game.Rulesets.Mania.Edit { public class ManiaEditPlayfield : ManiaPlayfield { - protected override bool DisplayJudgements => false; - public ManiaEditPlayfield(List stages) : base(stages) { } - - protected override ManiaStage CreateStage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction) - => new ManiaEditStage(firstColumnIndex, definition, ref normalColumnStartAction, ref specialColumnStartAction); } } diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs index fa33f41de3..a01947a60b 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs @@ -3,7 +3,6 @@ using osu.Framework.Graphics; using OpenTK; -using osu.Framework.Graphics.Cursor; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.UI; @@ -24,7 +23,5 @@ namespace osu.Game.Rulesets.Mania.Edit }; protected override Vector2 PlayfieldArea => Vector2.One; - - protected override CursorContainer CreateCursor() => null; } } diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs deleted file mode 100644 index 9068725023..0000000000 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs +++ /dev/null @@ -1,16 +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.Mania.Beatmaps; -using osu.Game.Rulesets.Mania.UI; - -namespace osu.Game.Rulesets.Mania.Edit -{ - public class ManiaEditStage : ManiaStage - { - public ManiaEditStage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction) - : base(firstColumnIndex, definition, ref normalColumnStartAction, ref specialColumnStartAction) - { - } - } -} diff --git a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs index 4d28c39faa..e183098a51 100644 --- a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs @@ -1,42 +1,14 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Edit.Types; +using osu.Game.Rulesets.Mania.Objects.Types; using osu.Game.Rulesets.Objects; -using osu.Game.Rulesets.Objects.Types; -using System; namespace osu.Game.Rulesets.Mania.Objects { - public abstract class ManiaHitObject : HitObject, IHasXPosition, IHasEditableColumn + public abstract class ManiaHitObject : HitObject, IHasColumn { - public event Action ColumnChanged; - - private int column { get; set; } - - public virtual int Column - { - get => column; - set - { - if (column == value) - return; - column = value; - - ColumnChanged?.Invoke(value); - } - } - - public virtual int Layer { get; set; } - - public virtual float X - { - get => Column; - } - - public virtual void OffsetColumn(int offset) => Column += offset; - - public virtual void OffsetLayer(int offset) => Layer += offset; + public virtual int Column { get; set; } protected override HitWindows CreateHitWindows() => new ManiaHitWindows(); } diff --git a/osu.Game/Rulesets/Objects/Types/IHasColumn.cs b/osu.Game.Rulesets.Mania/Objects/Types/IHasColumn.cs similarity index 90% rename from osu.Game/Rulesets/Objects/Types/IHasColumn.cs rename to osu.Game.Rulesets.Mania/Objects/Types/IHasColumn.cs index ba9c7ac933..44a79de7db 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasColumn.cs +++ b/osu.Game.Rulesets.Mania/Objects/Types/IHasColumn.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Rulesets.Objects.Types +namespace osu.Game.Rulesets.Mania.Objects.Types { /// /// A type of hit object which lies in one of a number of predetermined columns. diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index b3d11307a7..57a00f3820 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -4,25 +4,18 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Configuration; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Objects.Drawables; using System; using System.Collections.Generic; -using System.Linq; namespace osu.Game.Rulesets.Mania.UI { public class ManiaPlayfield : ManiaScrollingPlayfield { - public List Columns => stages.SelectMany(x => x.Columns).ToList(); - private readonly List stages = new List(); - public IReadOnlyList Stages => stages; - - protected virtual bool DisplayJudgements => true; public ManiaPlayfield(List stageDefinitions) { @@ -44,8 +37,7 @@ namespace osu.Game.Rulesets.Mania.UI int firstColumnIndex = 0; for (int i = 0; i < stageDefinitions.Count; i++) { - var newStage = CreateStage(firstColumnIndex, stageDefinitions[i], ref normalColumnAction, ref specialColumnAction); - newStage.DisplayJudgements = DisplayJudgements; + var newStage = new ManiaStage(firstColumnIndex, stageDefinitions[i], ref normalColumnAction, ref specialColumnAction); newStage.VisibleTimeRange.BindTo(VisibleTimeRange); playfieldGrid.Content[0][i] = newStage; @@ -57,11 +49,7 @@ namespace osu.Game.Rulesets.Mania.UI } } - public override void Add(DrawableHitObject h) - { - h.OnJudgement += OnJudgement; - getStageByColumn(((ManiaHitObject)h.HitObject).Column).Add(h); - } + public override void Add(DrawableHitObject h) => getStageByColumn(((ManiaHitObject)h.HitObject).Column).Add(h); public void Add(BarLine barline) => stages.ForEach(s => s.Add(barline)); @@ -83,16 +71,5 @@ namespace osu.Game.Rulesets.Mania.UI { maniaConfig.BindWith(ManiaSetting.ScrollTime, VisibleTimeRange); } - - internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) - { - if (!judgedObject.DisplayJudgement || !DisplayJudgements) - return; - - getStageByColumn(((ManiaHitObject)judgedObject.HitObject).Column).OnJudgement(judgedObject, judgement); - } - - protected virtual ManiaStage CreateStage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction) - => new ManiaStage(firstColumnIndex, definition, ref normalColumnStartAction, ref specialColumnStartAction); } } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs index 867eb1214b..b22217b73a 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs @@ -23,12 +23,10 @@ namespace osu.Game.Rulesets.Mania.UI /// /// A collection of s. /// - public class ManiaStage : ScrollingPlayfield + public class ManiaStage : ManiaScrollingPlayfield { public const float HIT_TARGET_POSITION = 50; - - public bool DisplayJudgements = true; public IReadOnlyList Columns => columnFlow.Children; private readonly FillFlowContainer columnFlow; diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 2301620116..a36f703fe6 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -24,17 +24,16 @@ namespace osu.Game.Rulesets.Edit { private readonly Ruleset ruleset; - protected ICompositionTool CurrentTool { get; private set; } + public IEnumerable HitObjects => rulesetContainer.Playfield.AllHitObjects; + protected ICompositionTool CurrentTool { get; private set; } protected IRulesetConfigManager Config { get; private set; } - protected RulesetContainer RulesetContainer; private readonly List layerContainers = new List(); - - public IEnumerable HitObjects => RulesetContainer.Playfield.AllHitObjects; - private readonly IBindable beatmap = new Bindable(); + private RulesetContainer rulesetContainer; + protected HitObjectComposer(Ruleset ruleset) { this.ruleset = ruleset; @@ -49,8 +48,8 @@ namespace osu.Game.Rulesets.Edit try { - RulesetContainer = CreateRulesetContainer(ruleset, beatmap.Value); - RulesetContainer.Clock = framedClock; + rulesetContainer = CreateRulesetContainer(ruleset, beatmap.Value); + rulesetContainer.Clock = framedClock; } catch (Exception e) { @@ -65,7 +64,7 @@ namespace osu.Game.Rulesets.Edit }; var layerAboveRuleset = CreateLayerContainer(); - layerAboveRuleset.Child = CreateHitObjectMaskLayer(); + layerAboveRuleset.Child = new HitObjectMaskLayer(); layerContainers.Add(layerBelowRuleset); layerContainers.Add(layerAboveRuleset); @@ -95,7 +94,7 @@ namespace osu.Game.Rulesets.Edit Children = new Drawable[] { layerBelowRuleset, - RulesetContainer, + rulesetContainer, layerAboveRuleset } } @@ -131,14 +130,13 @@ namespace osu.Game.Rulesets.Edit layerContainers.ForEach(l => { - l.Anchor = RulesetContainer.Playfield.Anchor; - l.Origin = RulesetContainer.Playfield.Origin; - l.Position = RulesetContainer.Playfield.Position; - l.Size = RulesetContainer.Playfield.Size; + l.Anchor = rulesetContainer.Playfield.Anchor; + l.Origin = rulesetContainer.Playfield.Origin; + l.Position = rulesetContainer.Playfield.Position; + l.Size = rulesetContainer.Playfield.Size; }); } - private void setCompositionTool(ICompositionTool tool) => CurrentTool = tool; protected virtual RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => ruleset.CreateRulesetContainerWith(beatmap); @@ -157,11 +155,6 @@ namespace osu.Game.Rulesets.Edit /// public virtual MaskSelection CreateMaskSelection() => new MaskSelection(); - /// - /// Creates a depending on the ruleset. - /// - protected virtual HitObjectMaskLayer CreateHitObjectMaskLayer() => new HitObjectMaskLayer(); - /// /// Creates a which provides a layer above or below the . /// diff --git a/osu.Game/Rulesets/Edit/HitObjectMask.cs b/osu.Game/Rulesets/Edit/HitObjectMask.cs index 3caa4d9fbf..61fb700dd3 100644 --- a/osu.Game/Rulesets/Edit/HitObjectMask.cs +++ b/osu.Game/Rulesets/Edit/HitObjectMask.cs @@ -33,21 +33,11 @@ namespace osu.Game.Rulesets.Edit /// public event Action SelectionRequested; - /// - /// Invoked when this has started drag. - /// - public event Action DragStarted; - /// /// Invoked when this has requested drag. /// public event Action DragRequested; - /// - /// Invoked when this has ended drag. - /// - public event Action DragEnded; - /// /// The which this applies to. /// @@ -130,11 +120,7 @@ namespace osu.Game.Rulesets.Edit return base.OnClick(state); } - protected override bool OnDragStart(InputState state) - { - DragStarted?.Invoke(this, state); - return true; - } + protected override bool OnDragStart(InputState state) => true; protected override bool OnDrag(InputState state) { @@ -142,12 +128,6 @@ namespace osu.Game.Rulesets.Edit return true; } - protected override bool OnDragEnd(InputState state) - { - DragEnded?.Invoke(this, state); - return true; - } - /// /// The screen-space point that causes this to be selected. /// diff --git a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs index 91062a211e..78ad236e74 100644 --- a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs +++ b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs @@ -1,8 +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 osu.Framework.Input; using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Edit.Tools @@ -10,15 +8,10 @@ namespace osu.Game.Rulesets.Edit.Tools public class HitObjectCompositionTool : ICompositionTool where T : HitObject { - public string Name { get; } = typeof(T).Name; - - public Func OnMouseDown; - public Func OnMouseUp; - public Func OnDragStart; - public Func OnDragRequested; - public Func OnDragEnd; + public string Name { get; } public HitObjectCompositionTool() + : this(typeof(T).Name) { } diff --git a/osu.Game/Rulesets/Edit/Types/IHasEditableColumn.cs b/osu.Game/Rulesets/Edit/Types/IHasEditableColumn.cs deleted file mode 100644 index 2691223476..0000000000 --- a/osu.Game/Rulesets/Edit/Types/IHasEditableColumn.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.Types; - -namespace osu.Game.Rulesets.Edit.Types -{ - public interface IHasEditableColumn : IHasColumn - { - void OffsetColumn(int offset); - } -} diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index db4ea05e59..41987a6bf9 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -32,9 +32,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers maskContainer.MaskSelected += maskSelection.HandleSelected; maskContainer.MaskDeselected += maskSelection.HandleDeselected; maskContainer.MaskSelectionRequested += maskSelection.HandleSelectionRequested; - maskContainer.MaskDragStarted += maskSelection.HandleDragStart; maskContainer.MaskDragRequested += maskSelection.HandleDrag; - maskContainer.MaskDragEnded += maskSelection.HandleDragEnd; maskSelection.DeselectAll = maskContainer.DeselectAll; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs index bce6d876be..df2691c28e 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs @@ -29,21 +29,11 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// public event Action MaskSelectionRequested; - /// - /// Invoked when any starts drag. - /// - public event Action MaskDragStarted; - /// /// Invoked when any requests drag. /// public event Action MaskDragRequested; - /// - /// Invoked when any ends drag. - /// - public event Action MaskDragEnded; - private IEnumerable aliveMasks => AliveInternalChildren.Cast(); public MaskContainer() @@ -60,9 +50,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers drawable.Selected += onMaskSelected; drawable.Deselected += onMaskDeselected; drawable.SelectionRequested += onSelectionRequested; - drawable.DragStarted += onDragStarted; drawable.DragRequested += onDragRequested; - drawable.DragEnded += onDragEnded; } public override bool Remove(HitObjectMask drawable) @@ -76,9 +64,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers drawable.Selected -= onMaskSelected; drawable.Deselected -= onMaskDeselected; drawable.SelectionRequested -= onSelectionRequested; - drawable.DragStarted -= onDragStarted; drawable.DragRequested -= onDragRequested; - drawable.DragEnded -= onDragEnded; } return result; @@ -117,9 +103,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers } private void onSelectionRequested(HitObjectMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state); - private void onDragStarted(HitObjectMask mask, InputState state) => MaskDragStarted?.Invoke(mask, state); private void onDragRequested(HitObjectMask mask, InputState state) => MaskDragRequested?.Invoke(mask, state); - private void onDragEnded(HitObjectMask mask, InputState state) => MaskDragEnded?.Invoke(mask, state); protected override int Compare(Drawable x, Drawable y) { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs index 7cd77eeb1c..54697bad77 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs @@ -25,7 +25,6 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers private readonly List selectedMasks; private Drawable outline; - private Vector2 startingPosition; public MaskSelection() { @@ -55,7 +54,6 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers #region User Input Handling - public void HandleDragStart(HitObjectMask m, InputState state) => startingPosition = state.Mouse.Position; public void HandleDrag(HitObjectMask m, InputState state) { // Todo: Various forms of snapping @@ -67,17 +65,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers case IHasEditablePosition editablePosition: editablePosition.OffsetPosition(state.Mouse.Delta); break; - case IHasEditableColumn editableColumn: - if (IsDragged) - editableColumn.OffsetColumn((int)((startingPosition.X - state.Mouse.Position.X) / m.Width)); // Perform snapping, needs fixing - break; } } } - public void HandleDragEnd(HitObjectMask m, InputState state) - { - - } #endregion From 693ba8e9949ea023092c6c3f5cf7ad1ce3266be3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 Jul 2018 18:43:11 +0900 Subject: [PATCH 151/304] Add more ToString output --- osu.Game/Beatmaps/WorkingBeatmap.cs | 2 ++ osu.Game/Rulesets/RulesetInfo.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 74da978d9c..3cdb1b7385 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -133,6 +133,8 @@ namespace osu.Game.Beatmaps return converted; } + public override string ToString() => BeatmapInfo.ToString(); + public bool BackgroundLoaded => background.IsResultAvailable; public Texture Background => background.Value.Result; public async Task GetBackgroundAsync() => await background.Value; diff --git a/osu.Game/Rulesets/RulesetInfo.cs b/osu.Game/Rulesets/RulesetInfo.cs index 10463fd961..a6a311f6eb 100644 --- a/osu.Game/Rulesets/RulesetInfo.cs +++ b/osu.Game/Rulesets/RulesetInfo.cs @@ -25,5 +25,7 @@ namespace osu.Game.Rulesets public virtual Ruleset CreateInstance() => (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo), this); public bool Equals(RulesetInfo other) => other != null && ID == other.ID && Available == other.Available && Name == other.Name && InstantiationInfo == other.InstantiationInfo; + + public override string ToString() => $"{Name} ({ShortName}) ID: {ID}"; } } From c31676f8f1d1981b83c5b2c184da40753f898c32 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 Jul 2018 18:48:40 +0900 Subject: [PATCH 152/304] Rework update methods to separate out ruleset and beatmap changes Combining them was causing complexity and logic errors. --- osu.Game/Screens/Select/SongSelect.cs | 70 ++++++++++++++++----------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index f8ceea2bf3..e2e6520ef1 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -138,7 +138,7 @@ namespace osu.Game.Screens.Select Size = new Vector2(carousel_width, 1), Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - SelectionChanged = b => updateSelectedBeatmap(b, null), + SelectionChanged = updateSelectedBeatmap, BeatmapSetsChanged = carouselBeatmapsLoaded, }, FilterControl = new FilterControl @@ -282,13 +282,31 @@ namespace osu.Game.Screens.Select private BeatmapInfo beatmapNoDebounce; private RulesetInfo rulesetNoDebounce; + private void updateSelectedBeatmap(BeatmapInfo beatmap) + { + if (beatmap?.Equals(beatmapNoDebounce) == true) + return; + + beatmapNoDebounce = beatmap; + performUpdateSelected(); + } + + private void updateSelectedRuleset(RulesetInfo ruleset) + { + if (ruleset?.Equals(rulesetNoDebounce) == true) + return; + + rulesetNoDebounce = ruleset; + performUpdateSelected(); + } + /// /// selection has been changed as the result of a user interaction. /// - private void updateSelectedBeatmap(BeatmapInfo beatmap, RulesetInfo ruleset) + private void performUpdateSelected() { - if (ruleset == null) ruleset = rulesetNoDebounce; - if (beatmap == null) beatmap = beatmapNoDebounce; + var beatmap = beatmapNoDebounce; + var ruleset = rulesetNoDebounce; void performLoad() { @@ -296,7 +314,7 @@ namespace osu.Game.Screens.Select bool preview = false; - if (ruleset?.Equals(Ruleset.Value) != true) + if (ruleset?.Equals(Ruleset.Value) == false) { Ruleset.Value = ruleset; @@ -307,40 +325,33 @@ namespace osu.Game.Screens.Select // We may be arriving here due to another component changing the bindable Beatmap. // In these cases, the other component has already loaded the beatmap, so we don't need to do so again. - if (beatmap?.Equals(Beatmap.Value.BeatmapInfo) != true) + if (!Equals(beatmap, Beatmap.Value.BeatmapInfo)) { preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID; working = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value); + + if (beatmap != null) + { + if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID) + sampleChangeDifficulty.Play(); + else + sampleChangeBeatmap.Play(); + } } working.Mods.Value = Enumerable.Empty(); - Beatmap.Value = working; ensurePlayingSelected(preview); - UpdateBeatmap(Beatmap.Value); } - if (beatmap?.Equals(beatmapNoDebounce) == true && ruleset?.Equals(rulesetNoDebounce) == true) - return; - selectionChangedDebounce?.Cancel(); - beatmapNoDebounce = beatmap; - rulesetNoDebounce = ruleset; - if (beatmap == null) performLoad(); else - { - if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID) - sampleChangeDifficulty.Play(); - else - sampleChangeBeatmap.Play(); - selectionChangedDebounce = Scheduler.AddDelayed(performLoad, 200); - } } private void triggerRandom() @@ -487,13 +498,16 @@ namespace osu.Game.Screens.Select private void carouselBeatmapsLoaded() { - // manual binding to parent ruleset to allow for delayed load in the incoming direction. - rulesetNoDebounce = Ruleset.Value = base.Ruleset.Value; - base.Ruleset.ValueChanged += r => updateSelectedBeatmap(null, r); - Ruleset.ValueChanged += r => base.Ruleset.Value = r; + if (rulesetNoDebounce == null) + { + // manual binding to parent ruleset to allow for delayed load in the incoming direction. + rulesetNoDebounce = Ruleset.Value = base.Ruleset.Value; + base.Ruleset.ValueChanged += updateSelectedRuleset; + Ruleset.ValueChanged += r => base.Ruleset.Value = r; - Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true); - Beatmap.BindValueChanged(workingBeatmapChanged); + Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true); + Beatmap.BindValueChanged(workingBeatmapChanged); + } if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false && Beatmap.Value.BeatmapSetInfo?.Protected == false && Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false)) @@ -503,7 +517,7 @@ namespace osu.Game.Screens.Select { // in the case random selection failed, we want to trigger selectionChanged // to show the dummy beatmap (we have nothing else to display). - updateSelectedBeatmap(null, null); + performUpdateSelected(); } } From d7f1766ee21a1c52fd935aa6c5ce564066101172 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 Jul 2018 18:51:08 +0900 Subject: [PATCH 153/304] wip --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 15 ++++++++++++--- osu.Game/Screens/Select/SongSelect.cs | 8 ++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index b73cf5bbd3..d1f4340876 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -86,7 +86,7 @@ namespace osu.Game.Tests.Visual Child = songSelect = new TestSongSelect(); } - [Test] + //[Test] public void TestDummy() { AddAssert("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap); @@ -99,7 +99,7 @@ namespace osu.Game.Tests.Visual AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); } - [Test] + //[Test] public void TestSorting() { addManyTestMaps(); @@ -116,11 +116,20 @@ namespace osu.Game.Tests.Visual [Test] public void TestRulesetChange() { + AddStep("change ruleset", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == 2)); + AddStep("import test maps", () => { manager.Import(createTestBeatmapSet(0, rulesets.AvailableRulesets.Where(r => r.ID == 0).ToArray())); - manager.Import(createTestBeatmapSet(1, rulesets.AvailableRulesets.Where(r => r.ID == 0).ToArray())); + manager.Import(createTestBeatmapSet(1, rulesets.AvailableRulesets.Where(r => r.ID == 2).ToArray())); + }); + + AddStep("change ruleset", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == 1)); + + AddUntilStep(() => songSelect.Carousel.SelectedBeatmap == null, "no selection"); + + AddStep("change ruleset", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == 0)); } private void addManyTestMaps() diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index e2e6520ef1..0f22d9b208 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -13,6 +13,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; +using osu.Framework.Logging; using osu.Framework.Screens; using osu.Framework.Threading; using osu.Game.Beatmaps; @@ -310,12 +311,15 @@ namespace osu.Game.Screens.Select void performLoad() { + Logger.Log($"performLoad with b:{beatmap} r:{ruleset}"); + WorkingBeatmap working = Beatmap.Value; bool preview = false; if (ruleset?.Equals(Ruleset.Value) == false) { + Logger.Log($"ruleset changed from {Ruleset.Value} to {ruleset}"); Ruleset.Value = ruleset; // force a filter before attempting to change the beatmap. @@ -327,6 +331,8 @@ namespace osu.Game.Screens.Select // In these cases, the other component has already loaded the beatmap, so we don't need to do so again. if (!Equals(beatmap, Beatmap.Value.BeatmapInfo)) { + Logger.Log($"beatmap changed from {Beatmap.Value.BeatmapInfo} to {beatmap}"); + preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID; working = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value); @@ -467,6 +473,8 @@ namespace osu.Game.Screens.Select /// The working beatmap. protected virtual void UpdateBeatmap(WorkingBeatmap beatmap) { + Logger.Log($"working beatmap updated to {beatmap}"); + if (Background is BackgroundScreenBeatmap backgroundModeBeatmap) { backgroundModeBeatmap.Beatmap = beatmap; From 1502edcdc6f2b194a088225c2dbfbb32b91727e8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 18:57:30 +0900 Subject: [PATCH 154/304] Specify tests directly --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 27f1484e32..4545feade0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,6 +17,8 @@ build: project: osu.sln parallel: true verbosity: minimal +test_script: + - cmd: dotnet test --configuration Debug --no-build --test-adapter-path:. --logger:Appveyor after_build: - cmd: inspectcode --o="inspectcodereport.xml" --projects:osu.Game* --caches-home="inspectcode" osu.sln > NUL - cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors From be297ddf76b51cfa108f2d30e7d9563575dc105a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 19 Jul 2018 19:30:20 +0900 Subject: [PATCH 155/304] Fix direction reversal not quite working correctly --- .../TestCaseEditor.cs | 15 ++++++++++++ .../Layers/Selection/Overlays/HoldNoteMask.cs | 23 +++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs index 799bb9efd8..6c0f931cda 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs @@ -2,6 +2,10 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Game.Rulesets.Mania.Configuration; +using osu.Game.Rulesets.Mania.UI; using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Mania.Tests @@ -9,9 +13,20 @@ namespace osu.Game.Rulesets.Mania.Tests [TestFixture] public class TestCaseEditor : EditorTestCase { + private readonly Bindable direction = new Bindable(); + public TestCaseEditor() : base(new ManiaRuleset()) { + AddStep("upwards scroll", () => direction.Value = ManiaScrollingDirection.Up); + AddStep("downwards scroll", () => direction.Value = ManiaScrollingDirection.Down); + } + + [BackgroundDependencyLoader] + private void load(RulesetConfigCache configCache) + { + var config = (ManiaConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance()); + config.BindWith(ManiaSetting.ScrollDirection, direction); } } } diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs index d0faea564c..745ce25a3e 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -2,17 +2,25 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Mania.UI; +using osu.Game.Rulesets.UI.Scrolling; +using OpenTK; using OpenTK.Graphics; namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays { public class HoldNoteMask : HitObjectMask { + public new DrawableHoldNote HitObject => (DrawableHoldNote)base.HitObject; + + private readonly IBindable direction = new Bindable(); + private readonly BodyPiece body; public HoldNoteMask(DrawableHoldNote hold) @@ -30,17 +38,25 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, IScrollingInfo scrollingInfo) { body.BorderColour = colours.Yellow; + + direction.BindTo(scrollingInfo.Direction); } protected override void Update() { base.Update(); - Size = HitObject.DrawSize; + Size = HitObject.DrawSize + new Vector2(0, HitObject.Tail.DrawHeight); Position = Parent.ToLocalSpace(HitObject.ScreenSpaceDrawQuad.TopLeft); + + // This is a side-effect of not matching the hitobject's anchors/origins, which is kinda hard to do + // When scrolling upwards our origin is at the top of the head note (which is where the origin already is), + // but when scrolling downwards our origin is at the _bottom_ of the tail note (where we need to be at the _top_ of the tail note) + if (direction.Value == ScrollingDirection.Down) + Y -= HitObject.Tail.DrawHeight; } private class HoldNoteNoteMask : NoteMask @@ -55,6 +71,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays { base.Update(); + Anchor = HitObject.Anchor; + Origin = HitObject.Origin; + Position = HitObject.DrawPosition; } } From c3c270621bf93b0916f871a18376df62af8e0932 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 19 Jul 2018 19:32:47 +0900 Subject: [PATCH 156/304] Fix hold note note masks blocking mouse input --- .../Edit/Layers/Selection/Overlays/HoldNoteMask.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs index 745ce25a3e..4b13bce39d 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -76,6 +76,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays Position = HitObject.DrawPosition; } + + // Todo: This is temporary, since the note masks don't do anything special yet. In the future they will handle input. + public override bool HandleMouseInput => false; } } } From 824c217a0d837a75e6b01987bbe0578f93bd4918 Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Thu, 19 Jul 2018 19:44:06 +0900 Subject: [PATCH 157/304] Adjust comment --- .../Edit/Layers/Selection/Overlays/HoldNoteMask.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs index 4b13bce39d..bfa6bc0a17 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays Position = Parent.ToLocalSpace(HitObject.ScreenSpaceDrawQuad.TopLeft); // This is a side-effect of not matching the hitobject's anchors/origins, which is kinda hard to do - // When scrolling upwards our origin is at the top of the head note (which is where the origin already is), + // When scrolling upwards our origin is already at the top of the head note (which is the intended location), // but when scrolling downwards our origin is at the _bottom_ of the tail note (where we need to be at the _top_ of the tail note) if (direction.Value == ScrollingDirection.Down) Y -= HitObject.Tail.DrawHeight; From 4e72794101d75c52b93acd1659d52079d5128b2b Mon Sep 17 00:00:00 2001 From: David V Date: Thu, 19 Jul 2018 15:55:38 +0200 Subject: [PATCH 158/304] Converts float to int. --- osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 48512a71c2..1b6c6f5ce8 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -41,14 +41,14 @@ namespace osu.Game.Rulesets.Objects.Legacy if (type.HasFlag(ConvertHitObjectType.Circle)) { - result = CreateHit(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo); + result = CreateHit(new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])), combo); if (split.Length > 5) readCustomSampleBanks(split[5], bankInfo); } else if (type.HasFlag(ConvertHitObjectType.Slider)) { - var pos = new Vector2(int.Parse(split[0]), int.Parse(split[1])); + var pos = new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])); CurveType curveType = CurveType.Catmull; double length = 0; @@ -170,7 +170,7 @@ namespace osu.Game.Rulesets.Objects.Legacy readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo); } - result = CreateHold(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, endTime + offset); + result = CreateHold(new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])), combo, endTime + offset); } if (result == null) From 9eb69a1e768848ab304b5134d8f3ca8fcfde098a Mon Sep 17 00:00:00 2001 From: David V Date: Thu, 19 Jul 2018 17:47:55 +0200 Subject: [PATCH 159/304] Restructure + corrects converting to support all systems --- .../Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 1b6c6f5ce8..dc1cd5ed3b 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -30,6 +30,8 @@ namespace osu.Game.Rulesets.Objects.Legacy { string[] split = text.Split(','); + 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; bool combo = type.HasFlag(ConvertHitObjectType.NewCombo); type &= ~ConvertHitObjectType.NewCombo; @@ -41,15 +43,13 @@ namespace osu.Game.Rulesets.Objects.Legacy if (type.HasFlag(ConvertHitObjectType.Circle)) { - result = CreateHit(new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])), combo); + result = CreateHit(pos, combo); if (split.Length > 5) readCustomSampleBanks(split[5], bankInfo); } else if (type.HasFlag(ConvertHitObjectType.Slider)) { - var pos = new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])); - CurveType curveType = CurveType.Catmull; double length = 0; var points = new List { Vector2.Zero }; @@ -170,7 +170,7 @@ namespace osu.Game.Rulesets.Objects.Legacy readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo); } - result = CreateHold(new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])), combo, endTime + offset); + result = CreateHold(pos, combo, endTime + offset); } if (result == null) From 64ead0fdf78ca048f9a3f799686091904c9f9180 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 Jul 2018 11:32:00 +0900 Subject: [PATCH 160/304] Add more tests and fix one remaining issue case --- .../Visual/TestCasePlaySongSelect.cs | 51 +++++++++++-------- osu.Game/Screens/Select/SongSelect.cs | 17 ++++--- 2 files changed, 40 insertions(+), 28 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index d1f4340876..0ec7dd059d 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -82,11 +82,10 @@ namespace osu.Game.Tests.Visual public virtual void SetUp() { manager?.Delete(manager.GetAllUsableBeatmapSets()); - Child = songSelect = new TestSongSelect(); } - //[Test] + [Test] public void TestDummy() { AddAssert("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap); @@ -99,7 +98,7 @@ namespace osu.Game.Tests.Visual AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); } - //[Test] + [Test] public void TestSorting() { addManyTestMaps(); @@ -114,24 +113,35 @@ namespace osu.Game.Tests.Visual } [Test] - public void TestRulesetChange() + public void ImportUnderDifferentRuleset() { - AddStep("change ruleset", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == 2)); - - AddStep("import test maps", () => - { - manager.Import(createTestBeatmapSet(0, rulesets.AvailableRulesets.Where(r => r.ID == 0).ToArray())); - manager.Import(createTestBeatmapSet(1, rulesets.AvailableRulesets.Where(r => r.ID == 2).ToArray())); - - }); - - AddStep("change ruleset", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == 1)); - + changeRuleset(2); + importForRuleset(0); AddUntilStep(() => songSelect.Carousel.SelectedBeatmap == null, "no selection"); - - AddStep("change ruleset", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == 0)); } + [Test] + public void ImportUnderCurrentRuleset() + { + changeRuleset(2); + importForRuleset(2); + importForRuleset(1); + AddUntilStep(() => songSelect.Carousel.SelectedBeatmap.RulesetID == 2, "has selection"); + + changeRuleset(1); + AddUntilStep(() => songSelect.Carousel.SelectedBeatmap.RulesetID == 1, "has selection"); + + changeRuleset(0); + AddUntilStep(() => songSelect.Carousel.SelectedBeatmap == null, "no selection"); + } + + private void importForRuleset(int id) => AddStep($"import test map for ruleset {id}", () => manager.Import(createTestBeatmapSet(getImportId(), rulesets.AvailableRulesets.Where(r => r.ID == id).ToArray()))); + + private static int importId; + private int getImportId() => ++importId; + + private void changeRuleset(int id) => AddStep($"change ruleset to {id}", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == id)); + private void addManyTestMaps() { AddStep("import test maps", () => @@ -143,18 +153,16 @@ namespace osu.Game.Tests.Visual }); } - private BeatmapSetInfo createTestBeatmapSet(int idOffset, RulesetInfo[] rulesets) + private BeatmapSetInfo createTestBeatmapSet(int setId, RulesetInfo[] rulesets) { int j = 0; RulesetInfo getRuleset() => rulesets[j++ % rulesets.Length]; var beatmaps = new List(); - int setId = 1234 + idOffset; - for (int i = 0; i < 6; i++) { - int beatmapId = 1234 + idOffset + i; + int beatmapId = setId * 10 + i; beatmaps.Add(new BeatmapInfo { @@ -169,7 +177,6 @@ namespace osu.Game.Tests.Visual }); } - return new BeatmapSetInfo { OnlineBeatmapSetID = setId, diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 0f22d9b208..76e8d695c8 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -309,9 +309,9 @@ namespace osu.Game.Screens.Select var beatmap = beatmapNoDebounce; var ruleset = rulesetNoDebounce; - void performLoad() + void run() { - Logger.Log($"performLoad with b:{beatmap} r:{ruleset}"); + Logger.Log($"updating selection with beatmap:{beatmap?.ID.ToString() ?? "null"} ruleset:{ruleset?.ID.ToString() ?? "null"}"); WorkingBeatmap working = Beatmap.Value; @@ -319,19 +319,24 @@ namespace osu.Game.Screens.Select if (ruleset?.Equals(Ruleset.Value) == false) { - Logger.Log($"ruleset changed from {Ruleset.Value} to {ruleset}"); + Logger.Log($"ruleset changed from \"{Ruleset.Value}\" to \"{ruleset}\""); Ruleset.Value = ruleset; // force a filter before attempting to change the beatmap. // we may still be in the wrong ruleset as there is a debounce delay on ruleset changes. Carousel.Filter(null, false); + + // Filtering only completes after the carousel runs Update. + // If we also have a pending beatmap change we should delay it one frame. + selectionChangedDebounce = Schedule(run); + return; } // We may be arriving here due to another component changing the bindable Beatmap. // In these cases, the other component has already loaded the beatmap, so we don't need to do so again. if (!Equals(beatmap, Beatmap.Value.BeatmapInfo)) { - Logger.Log($"beatmap changed from {Beatmap.Value.BeatmapInfo} to {beatmap}"); + Logger.Log($"beatmap changed from \"{Beatmap.Value.BeatmapInfo}\" to \"{beatmap}\""); preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID; working = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value); @@ -355,9 +360,9 @@ namespace osu.Game.Screens.Select selectionChangedDebounce?.Cancel(); if (beatmap == null) - performLoad(); + run(); else - selectionChangedDebounce = Scheduler.AddDelayed(performLoad, 200); + selectionChangedDebounce = Scheduler.AddDelayed(run, 200); } private void triggerRandom() From 967d0c3c72269e9fad90d090601c71a25a186ec5 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 20 Jul 2018 15:12:04 +0900 Subject: [PATCH 161/304] Adjust testcase --- .../Formats/LegacyBeatmapDecoderTest.cs | 18 +++++++++--------- ....osu => controlpoint-custom-samplebank.osu} | 0 ...-samples.osu => hitobject-file-samples.osu} | 0 3 files changed, 9 insertions(+), 9 deletions(-) rename osu.Game.Tests/Resources/{custom-samples.osu => controlpoint-custom-samplebank.osu} (100%) rename osu.Game.Tests/Resources/{custom-hitobject-samples.osu => hitobject-file-samples.osu} (100%) diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index 2f5b4a13d9..6b72dc5733 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -214,10 +214,10 @@ namespace osu.Game.Tests.Beatmaps.Formats } [Test] - public void TestDecodeCustomSamples() + public void TestDecodeControlPointCustomSampleBank() { var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; - using (var resStream = Resource.OpenResource("custom-samples.osu")) + using (var resStream = Resource.OpenResource("controlpoint-custom-samplebank.osu")) using (var stream = new StreamReader(resStream)) { var hitObjects = decoder.Decode(stream).HitObjects; @@ -228,25 +228,25 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.AreEqual("normal-hitnormal", getTestableSampleInfo(hitObjects[3]).LookupNames.First()); } - SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(new SampleInfo { Name = "hitnormal" }); + SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(hitObject.Samples[0]); } [Test] - public void TestDecodeCustomHitObjectSamples() + public void TestDecodeHitObjectCustomSampleBank() { var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; - using (var resStream = Resource.OpenResource("custom-hitobject-samples.osu")) + using (var resStream = Resource.OpenResource("hitobject-custom-samplebank.osu")) using (var stream = new StreamReader(resStream)) { var hitObjects = decoder.Decode(stream).HitObjects; - Assert.AreEqual("hit_1.wav", hitObjects[0].Samples[0].LookupNames.First()); - Assert.AreEqual("hit_2.wav", hitObjects[1].Samples[0].LookupNames.First()); + Assert.AreEqual("hit_1.wav", getTestableSampleInfo(hitObjects[0]).LookupNames.First()); + Assert.AreEqual("hit_2.wav", getTestableSampleInfo(hitObjects[1]).LookupNames.First()); Assert.AreEqual("normal-hitnormal2", getTestableSampleInfo(hitObjects[2]).LookupNames.First()); - Assert.AreEqual("hit_1.wav", hitObjects[3].Samples[0].LookupNames.First()); + Assert.AreEqual("hit_1.wav", getTestableSampleInfo(hitObjects[3]).LookupNames.First()); } - SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(new SampleInfo { Name = "hitnormal" }); + SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(hitObject.Samples[0]); } } } diff --git a/osu.Game.Tests/Resources/custom-samples.osu b/osu.Game.Tests/Resources/controlpoint-custom-samplebank.osu similarity index 100% rename from osu.Game.Tests/Resources/custom-samples.osu rename to osu.Game.Tests/Resources/controlpoint-custom-samplebank.osu diff --git a/osu.Game.Tests/Resources/custom-hitobject-samples.osu b/osu.Game.Tests/Resources/hitobject-file-samples.osu similarity index 100% rename from osu.Game.Tests/Resources/custom-hitobject-samples.osu rename to osu.Game.Tests/Resources/hitobject-file-samples.osu From de8d05bb0cbc64c80877ca2ee98a5388ff56c037 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 20 Jul 2018 15:12:21 +0900 Subject: [PATCH 162/304] Remove unnecessary setting of sample name to same value --- osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index acccbcde46..18680f9985 100644 --- a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -40,7 +40,6 @@ namespace osu.Game.Beatmaps.ControlPoints { var newSampleInfo = sampleInfo.Clone(); newSampleInfo.Bank = sampleInfo.Bank ?? SampleBank; - newSampleInfo.Name = sampleInfo.Name; newSampleInfo.Volume = sampleInfo.Volume > 0 ? sampleInfo.Volume : SampleVolume; return newSampleInfo; } From c087a73f403c73bdfb428d4b5bd1880097da2df4 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 20 Jul 2018 15:12:44 +0900 Subject: [PATCH 163/304] Implement per-hitobject custom sample banks --- .../Formats/LegacyBeatmapDecoderTest.cs | 17 ++++++++ .../Resources/hitobject-custom-samplebank.osu | 13 ++++++ osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 2 +- .../Objects/Legacy/ConvertHitObjectParser.cs | 41 ++++++++++++++----- 4 files changed, 62 insertions(+), 11 deletions(-) create mode 100644 osu.Game.Tests/Resources/hitobject-custom-samplebank.osu diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index 6b72dc5733..400380b407 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -240,6 +240,23 @@ namespace osu.Game.Tests.Beatmaps.Formats { var hitObjects = decoder.Decode(stream).HitObjects; + Assert.AreEqual("normal-hitnormal", getTestableSampleInfo(hitObjects[0]).LookupNames.First()); + Assert.AreEqual("normal-hitnormal2", getTestableSampleInfo(hitObjects[1]).LookupNames.First()); + Assert.AreEqual("normal-hitnormal3", getTestableSampleInfo(hitObjects[2]).LookupNames.First()); + } + + SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(hitObject.Samples[0]); + } + + [Test] + public void TestDecodeHitObjectFileSamples() + { + var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; + using (var resStream = Resource.OpenResource("hitobject-file-samples.osu")) + using (var stream = new StreamReader(resStream)) + { + var hitObjects = decoder.Decode(stream).HitObjects; + Assert.AreEqual("hit_1.wav", getTestableSampleInfo(hitObjects[0]).LookupNames.First()); Assert.AreEqual("hit_2.wav", getTestableSampleInfo(hitObjects[1]).LookupNames.First()); Assert.AreEqual("normal-hitnormal2", getTestableSampleInfo(hitObjects[2]).LookupNames.First()); diff --git a/osu.Game.Tests/Resources/hitobject-custom-samplebank.osu b/osu.Game.Tests/Resources/hitobject-custom-samplebank.osu new file mode 100644 index 0000000000..56b1a8762f --- /dev/null +++ b/osu.Game.Tests/Resources/hitobject-custom-samplebank.osu @@ -0,0 +1,13 @@ +osu file format v14 + +[General] +SampleSet: Normal + +[TimingPoints] +2170,468.75,4,1,0,40,1,0 +3107,-100,4,1,2,40,0,0 + +[HitObjects] +255,193,2170,1,0,0:0:0:0: +256,191,3107,5,0,0:0:0:0: +255,193,4000,1,0,0:0:3:70: diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 91c1c98438..76a3d75e36 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -188,7 +188,7 @@ namespace osu.Game.Beatmaps.Formats { var baseInfo = base.ApplyTo(sampleInfo); - if (CustomSampleBank > 1) + if (string.IsNullOrEmpty(baseInfo.Suffix) && CustomSampleBank > 1) baseInfo.Suffix = CustomSampleBank.ToString(); return baseInfo; diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 48512a71c2..5de05a99cc 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -194,8 +194,8 @@ namespace osu.Game.Rulesets.Objects.Legacy string[] split = str.Split(':'); - var bank = (LegacyBeatmapDecoder.LegacySampleBank)Convert.ToInt32(split[0]); - var addbank = (LegacyBeatmapDecoder.LegacySampleBank)Convert.ToInt32(split[1]); + var bank = (LegacyBeatmapDecoder.LegacySampleBank)int.Parse(split[0]); + var addbank = (LegacyBeatmapDecoder.LegacySampleBank)int.Parse(split[1]); string stringBank = bank.ToString().ToLower(); if (stringBank == @"none") @@ -207,6 +207,9 @@ namespace osu.Game.Rulesets.Objects.Legacy bankInfo.Normal = stringBank; bankInfo.Add = stringAddBank; + if (split.Length > 2) + bankInfo.CustomSampleBank = int.Parse(split[2]); + if (split.Length > 3) bankInfo.Volume = int.Parse(split[3]); @@ -258,41 +261,45 @@ namespace osu.Game.Rulesets.Objects.Legacy var soundTypes = new List { - new SampleInfo + new LegacySampleInfo { Bank = bankInfo.Normal, Name = SampleInfo.HIT_NORMAL, - Volume = bankInfo.Volume + Volume = bankInfo.Volume, + CustomSampleBank = bankInfo.CustomSampleBank } }; if (type.HasFlag(LegacySoundType.Finish)) { - soundTypes.Add(new SampleInfo + soundTypes.Add(new LegacySampleInfo { Bank = bankInfo.Add, Name = SampleInfo.HIT_FINISH, - Volume = bankInfo.Volume + Volume = bankInfo.Volume, + CustomSampleBank = bankInfo.CustomSampleBank }); } if (type.HasFlag(LegacySoundType.Whistle)) { - soundTypes.Add(new SampleInfo + soundTypes.Add(new LegacySampleInfo { Bank = bankInfo.Add, Name = SampleInfo.HIT_WHISTLE, - Volume = bankInfo.Volume + Volume = bankInfo.Volume, + CustomSampleBank = bankInfo.CustomSampleBank }); } if (type.HasFlag(LegacySoundType.Clap)) { - soundTypes.Add(new SampleInfo + soundTypes.Add(new LegacySampleInfo { Bank = bankInfo.Add, Name = SampleInfo.HIT_CLAP, - Volume = bankInfo.Volume + Volume = bankInfo.Volume, + CustomSampleBank = bankInfo.CustomSampleBank }); } @@ -307,9 +314,23 @@ namespace osu.Game.Rulesets.Objects.Legacy public string Add; public int Volume; + public int CustomSampleBank; + public SampleBankInfo Clone() => (SampleBankInfo)MemberwiseClone(); } + private class LegacySampleInfo : SampleInfo + { + public int CustomSampleBank + { + set + { + if (value > 1) + Suffix = value.ToString(); + } + } + } + private class FileSampleInfo : SampleInfo { public string Filename; From 7fea2b3a8b683e433451c7a504de0569bfd06de8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 Jul 2018 16:38:02 +0900 Subject: [PATCH 164/304] Add ToList --- 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 3bd5c440c1..67f02c8ac4 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -123,7 +123,7 @@ namespace osu.Game.Beatmaps private void validateOnlineIds(List beatmaps) { - var beatmapIds = beatmaps.Where(b => b.OnlineBeatmapID.HasValue).Select(b => b.OnlineBeatmapID); + var beatmapIds = beatmaps.Where(b => b.OnlineBeatmapID.HasValue).Select(b => b.OnlineBeatmapID).ToList(); // ensure all IDs are unique in this set and none match existing IDs in the local beatmap store. if (beatmapIds.GroupBy(b => b).Any(g => g.Count() > 1) || QueryBeatmaps(b => beatmapIds.Contains(b.OnlineBeatmapID)).Any()) From 1139f0dbf248ebf29dc96d53faa64aae26de8c55 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 20 Jul 2018 17:04:33 +0900 Subject: [PATCH 165/304] Centralise method of disabling playfield judgements --- osu.Game.Rulesets.Mania/UI/Column.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 6 ------ osu.Game.Rulesets.Mania/UI/ManiaStage.cs | 2 +- osu.Game.Rulesets.Osu/Edit/OsuEditPlayfield.cs | 12 ------------ .../Edit/OsuEditRulesetContainer.cs | 3 --- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 2 -- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 3 +++ osu.Game/Rulesets/Edit/HitObjectComposer.cs | 7 +++++++ osu.Game/Rulesets/UI/Playfield.cs | 8 ++++++++ 9 files changed, 20 insertions(+), 25 deletions(-) delete mode 100644 osu.Game.Rulesets.Osu/Edit/OsuEditPlayfield.cs diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index 063531da45..877189dd61 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -138,7 +138,7 @@ namespace osu.Game.Rulesets.Mania.UI internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) { - if (!judgement.IsHit || !judgedObject.DisplayJudgement) + if (!judgement.IsHit || !judgedObject.DisplayJudgement || !DisplayJudgements) return; explosionContainer.Add(new HitExplosion(judgedObject) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index d6781a6e8f..f88169726e 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -8,7 +8,6 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Mania.Configuration; @@ -74,10 +73,5 @@ namespace osu.Game.Rulesets.Mania.UI { maniaConfig.BindWith(ManiaSetting.ScrollTime, VisibleTimeRange); } - - internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) - { - getStageByColumn(((ManiaHitObject)judgedObject.HitObject).Column).OnJudgement(judgedObject, judgement); - } } } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs index a0ff8780ad..f386cf15a2 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs @@ -163,7 +163,7 @@ namespace osu.Game.Rulesets.Mania.UI internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) { - if (!judgedObject.DisplayJudgement) + if (!judgedObject.DisplayJudgement || !DisplayJudgements) return; judgements.Clear(); diff --git a/osu.Game.Rulesets.Osu/Edit/OsuEditPlayfield.cs b/osu.Game.Rulesets.Osu/Edit/OsuEditPlayfield.cs deleted file mode 100644 index 6213bb1329..0000000000 --- a/osu.Game.Rulesets.Osu/Edit/OsuEditPlayfield.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.Osu.UI; - -namespace osu.Game.Rulesets.Osu.Edit -{ - public class OsuEditPlayfield : OsuPlayfield - { - protected override bool DisplayJudgements => false; - } -} diff --git a/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs b/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs index ea33ec9ae0..6efa16bf56 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs @@ -4,7 +4,6 @@ using osu.Framework.Graphics.Cursor; using osu.Game.Beatmaps; using osu.Game.Rulesets.Osu.UI; -using osu.Game.Rulesets.UI; using OpenTK; namespace osu.Game.Rulesets.Osu.Edit @@ -16,8 +15,6 @@ namespace osu.Game.Rulesets.Osu.Edit { } - protected override Playfield CreatePlayfield() => new OsuEditPlayfield(); - protected override Vector2 PlayfieldArea => Vector2.One; protected override CursorContainer CreateCursor() => null; diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 04724931ae..b0ba9afee6 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -20,8 +20,6 @@ namespace osu.Game.Rulesets.Osu.UI private readonly JudgementContainer judgementLayer; private readonly ConnectionRenderer connectionLayer; - protected virtual bool DisplayJudgements => true; - public static readonly Vector2 BASE_SIZE = new Vector2(512, 384); public OsuPlayfield() diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index bb5994c2f2..4cb8dd48a7 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -226,6 +226,9 @@ namespace osu.Game.Rulesets.Taiko.UI internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) { + if (!DisplayJudgements) + return; + if (judgedObject.DisplayJudgement && judgementContainer.FirstOrDefault(j => j.JudgedObject == judgedObject) == null) { judgementContainer.Add(new DrawableTaikoJudgement(judgement, judgedObject) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 0c91c9f548..b2f6e909d2 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -110,6 +110,13 @@ namespace osu.Game.Rulesets.Edit toolboxCollection.Items[0].Select(); } + protected override void LoadComplete() + { + base.LoadComplete(); + + rulesetContainer.Playfield.DisplayJudgements.Value = false; + } + protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index f2c9b49900..2f44d99e18 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Allocation; +using osu.Framework.Configuration; namespace osu.Game.Rulesets.UI { @@ -21,6 +22,11 @@ namespace osu.Game.Rulesets.UI public IReadOnlyList NestedPlayfields => nestedPlayfields; private List nestedPlayfields; + /// + /// Whether judgements should be displayed by this and and all nested s. + /// + public readonly BindableBool DisplayJudgements = new BindableBool(true); + /// /// A container for keeping track of DrawableHitObjects. /// @@ -73,6 +79,8 @@ namespace osu.Game.Rulesets.UI nestedPlayfields = new List(); nestedPlayfields.Add(otherPlayfield); + + otherPlayfield.DisplayJudgements.BindTo(DisplayJudgements); } /// From 241437c819e89db8b6e06d45405d6d8fef30b689 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 Jul 2018 17:08:25 +0900 Subject: [PATCH 166/304] Remove unnecessary counting change logic --- osu.Game.Tests/Visual/TestCaseKeyCounter.cs | 1 - osu.Game/Screens/Play/HUDOverlay.cs | 1 - osu.Game/Screens/Play/KeyCounter.cs | 2 +- osu.Game/Screens/Play/KeyCounterCollection.cs | 3 +-- osu.Game/Screens/Play/Player.cs | 3 --- 5 files changed, 2 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs index a20f67e336..b98875cd6a 100644 --- a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs +++ b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs @@ -18,7 +18,6 @@ namespace osu.Game.Tests.Visual { Origin = Anchor.Centre, Anchor = Anchor.Centre, - IsCounting = true, Children = new KeyCounter[] { new KeyCounterKeyboard(Key.Z), diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index f920b20649..4f3fe15211 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -195,7 +195,6 @@ namespace osu.Game.Screens.Play protected virtual KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection { - IsCounting = true, FadeTime = 50, Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 2a0587133b..2c31e61114 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Play private Container textLayer; private SpriteText countSpriteText; - public bool IsCounting { get; set; } + public bool IsCounting { get; set; } = true; private int countPresses; public int CountPresses { diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 114ea83ba6..721d925d63 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -53,8 +53,7 @@ namespace osu.Game.Screens.Play configVisibility.BindValueChanged(_ => updateVisibility(), true); } - //further: change default values here and in KeyCounter if needed, instead of passing them in every constructor - private bool isCounting; + private bool isCounting = true; public bool IsCounting { get { return isCounting; } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 427519bff8..f28ddb09a2 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -224,9 +224,6 @@ namespace osu.Game.Screens.Play RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused); - // schedule to ensure we count any key presses from the current frame (which may affect gameplay). - RulesetContainer.IsPaused.ValueChanged += paused => Schedule(() => hudOverlay.KeyCounter.IsCounting = !paused); - if (ShowStoryboard) initializeStoryboard(false); From f200cfe40dec998572f43a1ed1c859c97c7c9d15 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Fri, 20 Jul 2018 13:05:19 +0300 Subject: [PATCH 167/304] Add labelled text box files --- .../LabelledComponents/LabelledTextBox.cs | 207 ++++++++++++++++++ .../Setup/Components/OsuSetupTextBox.cs | 24 ++ 2 files changed, 231 insertions(+) create mode 100644 osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs create mode 100644 osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs new file mode 100644 index 0000000000..e0c734f764 --- /dev/null +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -0,0 +1,207 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using System; + +namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents +{ + public class LabelledTextBox : CompositeDrawable + { + private readonly OsuSetupTextBox textBox; + private readonly Container content; + private readonly OsuSpriteText label; + + public const float LABEL_CONTAINER_WIDTH = 150; + public const float OUTER_CORNER_RADIUS = 15; + public const float INNER_CORNER_RADIUS = 10; + public const float DEFAULT_HEIGHT = 40; + public const float DEFAULT_LABEL_LEFT_PADDING = 15; + public const float DEFAULT_LABEL_TOP_PADDING = 12; + public const float DEFAULT_LABEL_TEXT_SIZE = 16; + + public event Action TextBoxTextChanged; + + public void TriggerTextBoxTextChanged(string newText) + { + TextBoxTextChanged?.Invoke(newText); + } + + private bool readOnly; + public bool ReadOnly + { + get => readOnly; + set + { + textBox.ReadOnly = value; + readOnly = value; + } + } + + private string labelText; + public string LabelText + { + get => labelText; + set + { + labelText = value; + label.Text = value; + } + } + + private float labelTextSize; + public float LabelTextSize + { + get => labelTextSize; + set + { + labelTextSize = value; + label.TextSize = value; + } + } + + private string textBoxPlaceholderText; + public string TextBoxPlaceholderText + { + get => textBoxPlaceholderText; + set + { + textBoxPlaceholderText = value; + textBox.PlaceholderText = value; + } + } + + private string textBoxText; + public string TextBoxText + { + get => textBoxText; + set + { + textBoxText = value; + textBox.Text = value; + TextBoxTextChanged?.Invoke(value); + } + } + + private float height = DEFAULT_HEIGHT; + public float Height + { + get => height; + private set + { + height = value; + textBox.Height = value; + content.Height = value; + } + } + + public MarginPadding Padding + { + get => base.Padding; + set + { + base.Padding = value; + base.Height = Height + base.Padding.Top; + } + } + + public MarginPadding LabelPadding + { + get => label.Padding; + set => label.Padding = value; + } + + public MarginPadding TextBoxPadding + { + get => textBox.Padding; + set => textBox.Padding = value; + } + + public Color4 LabelTextColour + { + get => label.Colour; + set => label.Colour = value; + } + + public Color4 BackgroundColour + { + get => content.Colour; + set => content.Colour = value; + } + + public LabelledTextBox() + { + Masking = true; + CornerRadius = OUTER_CORNER_RADIUS; + RelativeSizeAxes = Axes.X; + base.Height = DEFAULT_HEIGHT + Padding.Top; + + InternalChildren = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + Height = DEFAULT_HEIGHT, + CornerRadius = OUTER_CORNER_RADIUS, + Masking = true, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.X, + Height = DEFAULT_HEIGHT, + Colour = OsuColour.FromHex("1c2125"), + }, + new Container + { + RelativeSizeAxes = Axes.X, + Height = DEFAULT_HEIGHT, + Child = new GridContainer + { + RelativeSizeAxes = Axes.X, + Height = DEFAULT_HEIGHT, + Content = new[] + { + new Drawable[] + { + label = new OsuSpriteText + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Padding = new MarginPadding { Left = DEFAULT_LABEL_LEFT_PADDING, Top = DEFAULT_LABEL_TOP_PADDING }, + Colour = Color4.White, + TextSize = DEFAULT_LABEL_TEXT_SIZE, + Text = LabelText, + Font = @"Exo2.0-Bold", + }, + textBox = new OsuSetupTextBox + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + RelativeSizeAxes = Axes.X, + Height = DEFAULT_HEIGHT, + ReadOnly = ReadOnly, + CornerRadius = INNER_CORNER_RADIUS, + }, + }, + }, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, LABEL_CONTAINER_WIDTH), + new Dimension() + } + } + } + } + } + }; + + textBox.OnCommit += delegate { TriggerTextBoxTextChanged(textBox.Text); }; + } + } +} diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs new file mode 100644 index 0000000000..1a31582291 --- /dev/null +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.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.Allocation; +using osu.Framework.Graphics; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Screens.Edit.Screens.Setup.Components +{ + public class OsuSetupTextBox : OsuTextBox + { + protected override float LeftRightPadding => 15; + + [BackgroundDependencyLoader] + private void load(OsuColour osuColour) + { + BorderColour = osuColour.Blue; + } + + protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Colour = BorderColour, TextSize = CalculatedTextSize }; + } +} From 6dd5c7e5ab46b6fe548eff85ffc6871c232b71d9 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Fri, 20 Jul 2018 14:28:39 +0300 Subject: [PATCH 168/304] Add test case --- .../Visual/TestCaseLabelledTextBox.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs diff --git a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs new file mode 100644 index 0000000000..a9f0375d39 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs @@ -0,0 +1,37 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents; +using System; +using System.Collections.Generic; + +namespace osu.Game.Tests.Visual +{ + [TestFixture] + public class TestCaseLabelledTextBox : OsuTestCase + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(LabelledTextBox), + }; + + [BackgroundDependencyLoader] + private void load() + { + Children = new Drawable[] + { + new LabelledTextBox + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + LabelText = "Testing text", + TextBoxPlaceholderText = "This is definitely working as intended", + Padding = new MarginPadding { Left = 150, Right = 150 } + } + }; + } + } +} From 0f37758314c9f74b2119de35d5a3abc775fe52af Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 21 Jul 2018 11:38:28 +0900 Subject: [PATCH 169/304] Update framework --- .../Replays/CatchFramedReplayInputHandler.cs | 2 +- .../Replays/ManiaFramedReplayInputHandler.cs | 2 +- .../Objects/Drawables/Pieces/SliderBall.cs | 3 ++- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 2 +- osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs | 2 +- osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs | 1 + .../Replays/TaikoFramedReplayInputHandler.cs | 2 +- osu.Game.Tests/Visual/TestCaseCursors.cs | 2 +- osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs | 2 +- osu.Game/Beatmaps/IBeatmapConverter.cs | 1 + osu.Game/Beatmaps/IBeatmapProcessor.cs | 3 +++ osu.Game/Beatmaps/WorkingBeatmap.cs | 1 + osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs | 1 + .../Graphics/Containers/OsuFocusedOverlayContainer.cs | 2 +- osu.Game/Graphics/Containers/OsuHoverContainer.cs | 2 +- osu.Game/Graphics/Containers/OsuScrollContainer.cs | 3 ++- osu.Game/Graphics/Cursor/MenuCursor.cs | 3 ++- osu.Game/Graphics/UserInterface/DialogButton.cs | 2 +- osu.Game/Graphics/UserInterface/ExternalLinkButton.cs | 2 +- osu.Game/Graphics/UserInterface/FocusedTextBox.cs | 3 ++- osu.Game/Graphics/UserInterface/HoverClickSounds.cs | 2 +- osu.Game/Graphics/UserInterface/HoverSounds.cs | 2 +- osu.Game/Graphics/UserInterface/IconButton.cs | 2 +- osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs | 3 ++- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 2 +- osu.Game/Graphics/UserInterface/OsuMenu.cs | 2 +- osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs | 3 ++- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 3 ++- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 2 +- osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs | 2 +- osu.Game/Graphics/UserInterface/OsuTextBox.cs | 2 +- osu.Game/Graphics/UserInterface/PageTabControl.cs | 2 +- osu.Game/Graphics/UserInterface/SearchTextBox.cs | 3 ++- osu.Game/Graphics/UserInterface/TriangleButton.cs | 3 ++- osu.Game/Graphics/UserInterface/TwoLayerButton.cs | 3 ++- osu.Game/Input/Handlers/ReplayInputHandler.cs | 3 ++- .../20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs | 2 -- .../Migrations/20171209034410_AddRulesetInfoShortName.cs | 2 -- osu.Game/Migrations/20180125143340_Settings.cs | 2 -- osu.Game/Migrations/20180131154205_AddMuteBinding.cs | 2 -- osu.Game/Migrations/20180219060912_AddSkins.cs | 2 -- .../20180529055154_RemoveUniqueHashConstraints.cs | 2 -- .../20180621044111_UpdateTaikoDefaultBindings.cs | 1 - osu.Game/Migrations/OsuDbContextModelSnapshot.cs | 3 +-- osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs | 2 +- osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs | 2 +- osu.Game/Overlays/BeatmapSetOverlay.cs | 2 +- osu.Game/Overlays/Chat/ChannelListItem.cs | 2 +- osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs | 2 +- osu.Game/Overlays/Chat/ChatTabControl.cs | 3 ++- osu.Game/Overlays/ChatOverlay.cs | 2 +- osu.Game/Overlays/Dialog/PopupDialog.cs | 3 ++- osu.Game/Overlays/Direct/DirectGridPanel.cs | 2 +- osu.Game/Overlays/Direct/DirectListPanel.cs | 2 +- osu.Game/Overlays/Direct/DirectPanel.cs | 2 +- osu.Game/Overlays/Direct/PlayButton.cs | 2 +- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 8 +++++--- osu.Game/Overlays/MainSettings.cs | 3 ++- osu.Game/Overlays/MedalOverlay.cs | 4 ++-- osu.Game/Overlays/Mods/ModButton.cs | 3 ++- osu.Game/Overlays/Mods/ModSection.cs | 3 ++- osu.Game/Overlays/Music/PlaylistItem.cs | 3 ++- osu.Game/Overlays/Music/PlaylistList.cs | 2 +- osu.Game/Overlays/MusicController.cs | 2 +- osu.Game/Overlays/Notifications/Notification.cs | 2 +- osu.Game/Overlays/Profile/Header/BadgeContainer.cs | 2 +- osu.Game/Overlays/Profile/Header/RankGraph.cs | 2 +- osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs | 2 +- osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs | 2 +- osu.Game/Overlays/SearchableList/SearchableListOverlay.cs | 2 +- .../Overlays/Settings/Sections/General/LoginSettings.cs | 2 +- .../Overlays/Settings/Sections/Input/MouseSettings.cs | 1 + osu.Game/Overlays/Settings/SettingsItem.cs | 3 ++- osu.Game/Overlays/Settings/Sidebar.cs | 2 +- osu.Game/Overlays/Settings/SidebarButton.cs | 2 +- osu.Game/Overlays/SettingsOverlay.cs | 2 +- osu.Game/Overlays/Social/SocialPanel.cs | 2 +- osu.Game/Overlays/Toolbar/Toolbar.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 3 ++- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 3 ++- osu.Game/Overlays/Volume/MuteButton.cs | 2 +- osu.Game/Overlays/Volume/VolumeMeter.cs | 2 +- osu.Game/Overlays/VolumeOverlay.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectMask.cs | 3 ++- osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs | 8 +++----- osu.Game/Rulesets/UI/RulesetInputManager.cs | 3 +++ osu.Game/Screens/BackgroundScreen.cs | 3 ++- osu.Game/Screens/Edit/Components/PlaybackControl.cs | 2 +- .../Edit/Components/Timelines/Summary/Parts/MarkerPart.cs | 3 ++- osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Screens/Edit/Menus/EditorMenuBar.cs | 2 +- .../Screens/Edit/Screens/Compose/BeatDivisorControl.cs | 3 ++- osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs | 2 +- .../Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs | 3 ++- .../Screens/Edit/Screens/Compose/Layers/MaskContainer.cs | 2 +- .../Screens/Edit/Screens/Compose/Layers/MaskSelection.cs | 2 +- .../Screens/Compose/RadioButtons/DrawableRadioButton.cs | 2 +- .../Screens/Edit/Screens/Compose/Timeline/Timeline.cs | 3 ++- .../Screens/Compose/Timeline/ZoomableScrollContainer.cs | 2 +- osu.Game/Screens/Menu/Button.cs | 3 ++- osu.Game/Screens/Menu/MainMenu.cs | 3 ++- osu.Game/Screens/Menu/OsuLogo.cs | 3 ++- osu.Game/Screens/Multi/Components/DrawableRoom.cs | 2 +- osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs | 2 +- osu.Game/Screens/Multi/Screens/Match/Header.cs | 3 ++- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 3 ++- osu.Game/Screens/Play/HUD/ModDisplay.cs | 2 +- osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs | 3 ++- osu.Game/Screens/Play/HUD/QuitButton.cs | 3 ++- osu.Game/Screens/Play/HUDOverlay.cs | 3 ++- osu.Game/Screens/Play/KeyCounterCollection.cs | 3 ++- osu.Game/Screens/Play/KeyCounterKeyboard.cs | 3 ++- osu.Game/Screens/Play/KeyCounterMouse.cs | 3 ++- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 3 ++- .../Screens/Play/PlayerSettings/PlayerSettingsGroup.cs | 3 ++- osu.Game/Screens/Play/SkipOverlay.cs | 3 ++- osu.Game/Screens/Select/BeatmapCarousel.cs | 3 ++- .../Screens/Select/Carousel/DrawableCarouselBeatmap.cs | 2 +- osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 3 ++- osu.Game/Screens/Select/Footer.cs | 3 ++- osu.Game/Screens/Select/FooterButton.cs | 3 ++- osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs | 2 +- .../Select/Leaderboards/RetrievalFailurePlaceholder.cs | 3 ++- osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs | 3 ++- osu.Game/Screens/Select/SongSelect.cs | 3 ++- osu.Game/Tests/Visual/EditorClockTestCase.cs | 2 +- osu.Game/osu.Game.csproj | 2 +- 132 files changed, 183 insertions(+), 139 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs b/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs index 8d3d898655..f05eb31454 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using osu.Framework.Input; +using osu.Framework.Input.StateChanges; using osu.Framework.MathUtils; using osu.Game.Rulesets.Replays; diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs b/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs index 29eeb1cab5..ea239bf80f 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; -using osu.Framework.Input; +using osu.Framework.Input.StateChanges; using osu.Game.Rulesets.Replays; namespace osu.Game.Rulesets.Mania.Replays diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 894d972e47..92c42af861 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -5,7 +5,8 @@ using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Rulesets.Objects.Types; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index bb5fa1b575..5aba60ba03 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -4,7 +4,7 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs b/osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs index 2eed41d13f..5c07860b19 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; -using osu.Framework.Input; +using osu.Framework.Input.StateChanges; using osu.Framework.MathUtils; using osu.Game.Rulesets.Replays; using OpenTK; diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 7bd80b5718..0532fe0223 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Textures; using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Timing; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs index eae033401e..ab7856eb8f 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs @@ -4,7 +4,7 @@ using osu.Game.Rulesets.Replays; using System.Collections.Generic; using System.Linq; -using osu.Framework.Input; +using osu.Framework.Input.StateChanges; namespace osu.Game.Rulesets.Taiko.Replays { diff --git a/osu.Game.Tests/Visual/TestCaseCursors.cs b/osu.Game.Tests/Visual/TestCaseCursors.cs index 0aa8e9691e..361e255894 100644 --- a/osu.Game.Tests/Visual/TestCaseCursors.cs +++ b/osu.Game.Tests/Visual/TestCaseCursors.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.MathUtils; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Sprites; diff --git a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs index 130685a4cf..45b5ec2c11 100644 --- a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs @@ -8,7 +8,7 @@ using System.Linq; using OpenTK.Input; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; using osu.Framework.Logging; using osu.Game.Screens.Play; diff --git a/osu.Game/Beatmaps/IBeatmapConverter.cs b/osu.Game/Beatmaps/IBeatmapConverter.cs index cbf9d184ac..a710afad16 100644 --- a/osu.Game/Beatmaps/IBeatmapConverter.cs +++ b/osu.Game/Beatmaps/IBeatmapConverter.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; namespace osu.Game.Beatmaps diff --git a/osu.Game/Beatmaps/IBeatmapProcessor.cs b/osu.Game/Beatmaps/IBeatmapProcessor.cs index 282662373a..4d634d7912 100644 --- a/osu.Game/Beatmaps/IBeatmapProcessor.cs +++ b/osu.Game/Beatmaps/IBeatmapProcessor.cs @@ -1,6 +1,9 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Rulesets; +using osu.Game.Rulesets.Objects; + namespace osu.Game.Beatmaps { /// diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 74da978d9c..cfd34d44e7 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -14,6 +14,7 @@ using osu.Framework.IO.File; using System.IO; using osu.Game.IO.Serialization; using osu.Game.Rulesets; +using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI; using osu.Game.Skinning; diff --git a/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs b/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs index 0e0a9a3bb9..d2e6ac1db8 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs @@ -3,6 +3,7 @@ using System.Linq; using osu.Framework.Audio.Track; +using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Beatmaps diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 0dc6297ad2..d2ab8441eb 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -5,10 +5,10 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; using OpenTK; using osu.Framework.Configuration; using osu.Framework.Input.Bindings; +using osu.Framework.Input.States; using osu.Game.Audio; using osu.Game.Input.Bindings; using osu.Game.Overlays; diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index e88dad93ef..12df19e7c0 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -6,7 +6,7 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; -using osu.Framework.Input; +using osu.Framework.Input.States; namespace osu.Game.Graphics.Containers { diff --git a/osu.Game/Graphics/Containers/OsuScrollContainer.cs b/osu.Game/Graphics/Containers/OsuScrollContainer.cs index ebea9c49de..6d42be6fca 100644 --- a/osu.Game/Graphics/Containers/OsuScrollContainer.cs +++ b/osu.Game/Graphics/Containers/OsuScrollContainer.cs @@ -2,7 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using OpenTK.Input; namespace osu.Game.Graphics.Containers diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 517be4c055..b55e1aa5dd 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -8,11 +8,12 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; using osu.Game.Configuration; using System; using JetBrains.Annotations; using osu.Framework.Graphics.Textures; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using OpenTK.Input; namespace osu.Game.Graphics.Cursor diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 17d22587ad..ee2448ff02 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -13,7 +13,7 @@ using osu.Game.Graphics.Sprites; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Graphics.Containers; using osu.Framework.Configuration; -using osu.Framework.Input; +using osu.Framework.Input.States; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs index be2412ccad..fe8995f310 100644 --- a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs +++ b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Platform; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs index 28d04c9a82..e4fd71e17e 100644 --- a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs +++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs @@ -2,8 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Graphics; -using osu.Framework.Input; using System; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Input.Bindings; using OpenTK.Input; diff --git a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs index 1a9d124dfb..27a06ba0b7 100644 --- a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Extensions; -using osu.Framework.Input; +using osu.Framework.Input.States; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/HoverSounds.cs b/osu.Game/Graphics/UserInterface/HoverSounds.cs index dc35c75cd6..821305bc92 100644 --- a/osu.Game/Graphics/UserInterface/HoverSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverSounds.cs @@ -8,7 +8,7 @@ using osu.Framework.Audio.Sample; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.States; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/IconButton.cs b/osu.Game/Graphics/UserInterface/IconButton.cs index eca7bf57c8..be60812ba6 100644 --- a/osu.Game/Graphics/UserInterface/IconButton.cs +++ b/osu.Game/Graphics/UserInterface/IconButton.cs @@ -4,7 +4,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; -using osu.Framework.Input; +using osu.Framework.Input.States; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs index 990a2f20a9..4428a058db 100644 --- a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs @@ -6,7 +6,8 @@ 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.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics.Containers; using OpenTK.Graphics; diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index ea337d5f42..68f59bd8cd 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -8,7 +8,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index 41aeb534f0..abb077e94f 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics.Sprites; using OpenTK; diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs index 07920865c0..75655ddb36 100644 --- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs @@ -9,7 +9,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.Platform; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 7604009aab..b7b5319e06 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -11,9 +11,10 @@ using osu.Framework.Audio.Sample; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index d015a563f6..1b91d0cad3 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -14,7 +14,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.MathUtils; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs index 13740c935f..04ba111153 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Sprites; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/OsuTextBox.cs b/osu.Game/Graphics/UserInterface/OsuTextBox.cs index 88b0543de0..7a45ffdd4b 100644 --- a/osu.Game/Graphics/UserInterface/OsuTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTextBox.cs @@ -5,11 +5,11 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Input.Bindings; +using osu.Framework.Input.States; using osu.Game.Input.Bindings; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs index 3a8c72725e..d203532f9c 100644 --- a/osu.Game/Graphics/UserInterface/PageTabControl.cs +++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index 7d53c9e9d9..6067481979 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -2,7 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using OpenTK; using OpenTK.Input; diff --git a/osu.Game/Graphics/UserInterface/TriangleButton.cs b/osu.Game/Graphics/UserInterface/TriangleButton.cs index a6492ddd63..bfdc0c3bef 100644 --- a/osu.Game/Graphics/UserInterface/TriangleButton.cs +++ b/osu.Game/Graphics/UserInterface/TriangleButton.cs @@ -9,7 +9,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index dd5454314d..4e6361d1ae 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -4,7 +4,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; using OpenTK; using OpenTK.Graphics; using osu.Game.Graphics.Sprites; @@ -14,6 +13,8 @@ using osu.Game.Beatmaps.ControlPoints; using osu.Framework.Audio.Track; using System; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Input/Handlers/ReplayInputHandler.cs b/osu.Game/Input/Handlers/ReplayInputHandler.cs index 57a2e5df6d..5f53868b28 100644 --- a/osu.Game/Input/Handlers/ReplayInputHandler.cs +++ b/osu.Game/Input/Handlers/ReplayInputHandler.cs @@ -3,8 +3,9 @@ using System; using System.Collections.Generic; -using osu.Framework.Input; using osu.Framework.Input.Handlers; +using osu.Framework.Input.StateChanges; +using osu.Framework.Input.States; using osu.Framework.Platform; using OpenTK; diff --git a/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs b/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs index 66ebda785b..084ae67940 100644 --- a/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs +++ b/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs @@ -1,6 +1,4 @@ using Microsoft.EntityFrameworkCore.Migrations; -using System; -using System.Collections.Generic; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs b/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs index 5227d1f8f9..09cf0af89c 100644 --- a/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs +++ b/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs @@ -1,6 +1,4 @@ using Microsoft.EntityFrameworkCore.Migrations; -using System; -using System.Collections.Generic; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20180125143340_Settings.cs b/osu.Game/Migrations/20180125143340_Settings.cs index 20701d672a..2e2768dc7c 100644 --- a/osu.Game/Migrations/20180125143340_Settings.cs +++ b/osu.Game/Migrations/20180125143340_Settings.cs @@ -1,6 +1,4 @@ using Microsoft.EntityFrameworkCore.Migrations; -using System; -using System.Collections.Generic; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20180131154205_AddMuteBinding.cs b/osu.Game/Migrations/20180131154205_AddMuteBinding.cs index 374830ad93..5564a30bbf 100644 --- a/osu.Game/Migrations/20180131154205_AddMuteBinding.cs +++ b/osu.Game/Migrations/20180131154205_AddMuteBinding.cs @@ -1,6 +1,4 @@ using Microsoft.EntityFrameworkCore.Migrations; -using System; -using System.Collections.Generic; using Microsoft.EntityFrameworkCore.Infrastructure; using osu.Game.Database; using osu.Game.Input.Bindings; diff --git a/osu.Game/Migrations/20180219060912_AddSkins.cs b/osu.Game/Migrations/20180219060912_AddSkins.cs index 6cce4354d9..a0270ab0fd 100644 --- a/osu.Game/Migrations/20180219060912_AddSkins.cs +++ b/osu.Game/Migrations/20180219060912_AddSkins.cs @@ -1,6 +1,4 @@ using Microsoft.EntityFrameworkCore.Migrations; -using System; -using System.Collections.Generic; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs b/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs index fe8c983a3f..27269cc5fc 100644 --- a/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs +++ b/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs @@ -1,6 +1,4 @@ using Microsoft.EntityFrameworkCore.Migrations; -using System; -using System.Collections.Generic; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs index 1f3c015614..71304ea979 100644 --- a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs +++ b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs @@ -1,5 +1,4 @@ using Microsoft.EntityFrameworkCore.Migrations; -using osu.Framework.Logging; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index bd80cb743b..6dbeaed62f 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -1,8 +1,7 @@ // -using System; + using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using osu.Game.Database; namespace osu.Game.Migrations diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs index 6b75ac095d..8186bf8685 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs @@ -10,7 +10,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.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs index 505b7a7540..18391c1177 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.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.Audio; using osu.Game.Beatmaps; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs index 1f1a2a68d2..dc350d2c4c 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs @@ -3,10 +3,10 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Input.States; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Users; -using osu.Framework.Input; namespace osu.Game.Overlays.BeatmapSet.Scores { diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index fc8b3a6800..d9af81c19a 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -6,7 +6,7 @@ using osu.Framework.Allocation; 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 osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index b3ceffd35e..a1ebab09b1 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -8,7 +8,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 osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 88f0a72ddf..02cc89e57e 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.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.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index 910c87e0a8..7a60bf9f47 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -9,7 +9,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 57f2cd405d..4e4fe4f10a 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -10,7 +10,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.Backgrounds; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 91b790ece4..2e3c9f9c5f 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -17,6 +16,8 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Configuration; using System; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Chat diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index a2542c537f..8e20d76914 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -13,7 +13,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Threading; using osu.Game.Configuration; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index e32d7fb036..c9c90b4555 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -8,7 +8,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index c9e6f39270..eb940bff60 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -11,7 +11,7 @@ using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 17c5153dab..45e1164a57 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -12,7 +12,7 @@ using osu.Game.Graphics.Sprites; using osu.Framework.Allocation; using osu.Framework.Localisation; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Beatmaps; namespace osu.Game.Overlays.Direct diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 76da4b61b0..7d5c0c16cc 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; diff --git a/osu.Game/Overlays/Direct/PlayButton.cs b/osu.Game/Overlays/Direct/PlayButton.cs index 28cc484109..092c9ddbea 100644 --- a/osu.Game/Overlays/Direct/PlayButton.cs +++ b/osu.Game/Overlays/Direct/PlayButton.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index d407dc9cf9..86baaf3905 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -9,14 +9,16 @@ 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.Bindings; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Input; using OpenTK.Graphics; using OpenTK.Input; +using JoystickEventArgs = osu.Framework.Input.EventArgs.JoystickEventArgs; namespace osu.Game.Overlays.KeyBinding { @@ -230,7 +232,7 @@ namespace osu.Game.Overlays.KeyBinding return true; } - protected override bool OnJoystickPress(InputState state, Framework.Input.JoystickEventArgs args) + protected override bool OnJoystickPress(InputState state, JoystickEventArgs args) { if (!HasFocus) return false; @@ -241,7 +243,7 @@ namespace osu.Game.Overlays.KeyBinding return true; } - protected override bool OnJoystickRelease(InputState state, Framework.Input.JoystickEventArgs args) + protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) { if (!HasFocus) return base.OnJoystickRelease(state, args); diff --git a/osu.Game/Overlays/MainSettings.cs b/osu.Game/Overlays/MainSettings.cs index 99a86f19a1..6e8b4494dc 100644 --- a/osu.Game/Overlays/MainSettings.cs +++ b/osu.Game/Overlays/MainSettings.cs @@ -5,8 +5,9 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; using osu.Framework.Input.Bindings; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 97a9217b23..bd67a718a7 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -16,11 +16,11 @@ using osu.Framework.Allocation; using osu.Framework.Audio.Sample; using osu.Framework.Audio; using osu.Framework.Graphics.Textures; -using osu.Framework.Input; using OpenTK.Input; -using System.Linq; using osu.Framework.Graphics.Shapes; using System; +using System.Linq; +using osu.Framework.Input.States; using osu.Framework.MathUtils; namespace osu.Game.Overlays diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index f4e0e3db04..8024f9a732 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -7,13 +7,14 @@ using OpenTK.Input; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; using System; using System.Linq; using osu.Framework.Graphics.Cursor; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Mods diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 48f51f72ca..2fb44bb927 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -6,12 +6,13 @@ using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Mods; using System; using System.Linq; using System.Collections.Generic; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; namespace osu.Game.Overlays.Mods { diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index a630a86fce..62c9020160 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -8,7 +8,8 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index 19ce0cf932..32674f0a84 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -8,7 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using OpenTK; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 56af04c498..3def4c144e 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -13,7 +13,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Localisation; using osu.Framework.Threading; using osu.Game.Beatmaps; diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index 3a3fcb54e0..6798ae2bb2 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -7,11 +7,11 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.States; using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Notifications diff --git a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs index f968f94187..bfade5e45c 100644 --- a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs +++ b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Users; diff --git a/osu.Game/Overlays/Profile/Header/RankGraph.cs b/osu.Game/Overlays/Profile/Header/RankGraph.cs index 2c70507536..a059792796 100644 --- a/osu.Game/Overlays/Profile/Header/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/RankGraph.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs b/osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs index 3c841cbf14..3a4bfc6804 100644 --- a/osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs +++ b/osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs @@ -6,7 +6,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 OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 15b446efa5..38bc419838 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -8,7 +8,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.Containers; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index 47cdb4a765..f9e4a983bb 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -5,7 +5,7 @@ using OpenTK.Graphics; 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.Backgrounds; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 9a42bdd2aa..c7f98f4107 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -11,12 +11,12 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using OpenTK; -using osu.Framework.Input; using osu.Game.Users; using System.ComponentModel; using osu.Game.Graphics; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Input.States; using RectangleF = osu.Framework.Graphics.Primitives.RectangleF; using Container = osu.Framework.Graphics.Containers.Container; diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 51a624330b..71ab4d3782 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 4c1ea1f32e..0f8d3aa2ac 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -12,7 +12,8 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK; diff --git a/osu.Game/Overlays/Settings/Sidebar.cs b/osu.Game/Overlays/Settings/Sidebar.cs index 50452a7110..fdda5b870e 100644 --- a/osu.Game/Overlays/Settings/Sidebar.cs +++ b/osu.Game/Overlays/Settings/Sidebar.cs @@ -9,7 +9,7 @@ using OpenTK.Graphics; 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.Framework.Threading; using osu.Game.Overlays.Toolbar; diff --git a/osu.Game/Overlays/Settings/SidebarButton.cs b/osu.Game/Overlays/Settings/SidebarButton.cs index 0a3a30480b..ac2c840c94 100644 --- a/osu.Game/Overlays/Settings/SidebarButton.cs +++ b/osu.Game/Overlays/Settings/SidebarButton.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 55326b53ed..83e121e998 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -11,7 +11,7 @@ using osu.Framework.Extensions.IEnumerableExtensions; 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.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; diff --git a/osu.Game/Overlays/Social/SocialPanel.cs b/osu.Game/Overlays/Social/SocialPanel.cs index 2411db7535..b0455f7edd 100644 --- a/osu.Game/Overlays/Social/SocialPanel.cs +++ b/osu.Game/Overlays/Social/SocialPanel.cs @@ -6,7 +6,7 @@ using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Users; namespace osu.Game.Overlays.Social diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index eeace2f11c..2eabf1eb74 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -6,12 +6,12 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; using osu.Game.Graphics; using OpenTK; using osu.Framework.Graphics.Shapes; using osu.Framework.Allocation; using osu.Framework.Configuration; +using osu.Framework.Input.States; namespace osu.Game.Overlays.Toolbar { diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 4514f3c33c..74af5d7e9c 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -5,13 +5,14 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index b1af3f0d62..f2744ae83f 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -6,12 +6,13 @@ using osu.Framework.Allocation; using osu.Framework.Caching; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; using OpenTK; using OpenTK.Input; using OpenTK.Graphics; using osu.Framework.Configuration; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Rulesets; namespace osu.Game.Overlays.Toolbar diff --git a/osu.Game/Overlays/Volume/MuteButton.cs b/osu.Game/Overlays/Volume/MuteButton.cs index d0aa58e668..47169d7a7b 100644 --- a/osu.Game/Overlays/Volume/MuteButton.cs +++ b/osu.Game/Overlays/Volume/MuteButton.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index 9aeca1f35f..a6c98aa97e 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -11,7 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/VolumeOverlay.cs b/osu.Game/Overlays/VolumeOverlay.cs index e40597b2d4..4dcdd23768 100644 --- a/osu.Game/Overlays/VolumeOverlay.cs +++ b/osu.Game/Overlays/VolumeOverlay.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Threading; using osu.Game.Graphics; using osu.Game.Input.Bindings; diff --git a/osu.Game/Rulesets/Edit/HitObjectMask.cs b/osu.Game/Rulesets/Edit/HitObjectMask.cs index 61fb700dd3..ada026b32f 100644 --- a/osu.Game/Rulesets/Edit/HitObjectMask.cs +++ b/osu.Game/Rulesets/Edit/HitObjectMask.cs @@ -5,7 +5,8 @@ using System; using osu.Framework; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; diff --git a/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs index f13d96b35e..edad5cff80 100644 --- a/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs +++ b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs @@ -3,12 +3,10 @@ using System; using System.Collections.Generic; -using osu.Framework.Input; +using osu.Framework.Input.StateChanges; using osu.Game.Input.Handlers; using OpenTK; using OpenTK.Input; -using KeyboardState = osu.Framework.Input.KeyboardState; -using MouseState = osu.Framework.Input.MouseState; namespace osu.Game.Rulesets.Replays { @@ -107,7 +105,7 @@ namespace osu.Game.Rulesets.Replays return CurrentTime = time; } - protected class ReplayMouseState : MouseState + protected class ReplayMouseState : osu.Framework.Input.States.MouseState { public ReplayMouseState(Vector2 position) { @@ -115,7 +113,7 @@ namespace osu.Game.Rulesets.Replays } } - protected class ReplayKeyboardState : KeyboardState + protected class ReplayKeyboardState : osu.Framework.Input.States.KeyboardState { public ReplayKeyboardState(List keys) { diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index a3120179a4..b05efce146 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -9,6 +9,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Framework.Input.Bindings; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.StateChanges; +using osu.Framework.Input.States; using osu.Framework.Timing; using osu.Game.Configuration; using osu.Game.Input.Bindings; diff --git a/osu.Game/Screens/BackgroundScreen.cs b/osu.Game/Screens/BackgroundScreen.cs index 9d9432b2ce..46d1260410 100644 --- a/osu.Game/Screens/BackgroundScreen.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -5,7 +5,8 @@ using System; using System.Threading; using osu.Framework.Screens; using osu.Framework.Graphics; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using OpenTK; namespace osu.Game.Screens diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index 5f62843faf..6cd7fd52d4 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -8,7 +8,7 @@ using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Timing; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs index 0dc110951b..7ff3849361 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs @@ -6,7 +6,8 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index a52fa3b462..7159cd919c 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -12,7 +12,7 @@ using osu.Game.Screens.Edit.Menus; using osu.Game.Screens.Edit.Components.Timelines.Summary; using osu.Framework.Allocation; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Platform; using osu.Framework.Timing; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs b/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs index cb7c0fa803..c6351c8520 100644 --- a/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs +++ b/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs @@ -6,12 +6,12 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK; using OpenTK.Graphics; using osu.Framework.Configuration; +using osu.Framework.Input.States; using osu.Game.Screens.Edit.Screens; namespace osu.Game.Screens.Edit.Menus diff --git a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs index 21e48d8b0a..63df143ca8 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs @@ -12,7 +12,8 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs index d8200d6c37..c4392bbc60 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Rulesets.Edit; using OpenTK.Graphics; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index b9a8e9914a..03ac8e91f0 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -5,7 +5,8 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs index df2691c28e..5ee31769a3 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Rulesets.Edit; using RectangleF = osu.Framework.Graphics.Primitives.RectangleF; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs index 54697bad77..927e7a2342 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs @@ -7,7 +7,7 @@ using osu.Framework.Allocation; 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.Rulesets.Edit; using osu.Game.Rulesets.Edit.Types; diff --git a/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs b/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs index 0a009d9958..803a1275d7 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs index 8cb0fdd908..30205c5aa1 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs @@ -7,7 +7,8 @@ using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Audio; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs index 0bfea68e50..d30aaacc6a 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs @@ -5,7 +5,7 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Transforms; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.MathUtils; using OpenTK; diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 29820f234d..e53905a102 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -9,7 +9,6 @@ using osu.Framework.Audio.Sample; 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 OpenTK; @@ -18,6 +17,8 @@ using OpenTK.Input; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Graphics.Containers; using osu.Framework.Audio.Track; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Beatmaps.ControlPoints; namespace osu.Game.Screens.Menu diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 4790996833..7e97859be6 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -6,7 +6,8 @@ using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index b74546310f..f0f765a4c9 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -11,7 +11,8 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.MathUtils; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Multi/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Components/DrawableRoom.cs index 54bd0ae7cc..739346fabe 100644 --- a/osu.Game/Screens/Multi/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Components/DrawableRoom.cs @@ -10,7 +10,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.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs index 51dea355bf..1a47829ad7 100644 --- a/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs +++ b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs @@ -6,7 +6,7 @@ using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Screens; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Multiplayer; diff --git a/osu.Game/Screens/Multi/Screens/Match/Header.cs b/osu.Game/Screens/Multi/Screens/Match/Header.cs index 02e717d4be..cc31f10fd2 100644 --- a/osu.Game/Screens/Multi/Screens/Match/Header.cs +++ b/osu.Game/Screens/Multi/Screens/Match/Header.cs @@ -8,7 +8,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index 52c08bb351..1ca3bc2189 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -5,7 +5,6 @@ using System; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; @@ -17,6 +16,8 @@ using OpenTK.Input; using System.Collections.Generic; using System.Linq; using osu.Framework.Input.Bindings; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Input.Bindings; namespace osu.Game.Screens.Play diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 33a8e1d7cf..894322dd41 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -10,9 +10,9 @@ using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; using OpenTK; -using osu.Framework.Input; using osu.Game.Graphics.Containers; using System.Linq; +using osu.Framework.Input.States; namespace osu.Game.Screens.Play.HUD { diff --git a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs index 9025f323be..e5e2ed7ee0 100644 --- a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs @@ -3,8 +3,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using OpenTK; -using osu.Framework.Input; using osu.Game.Screens.Play.PlayerSettings; using OpenTK.Input; diff --git a/osu.Game/Screens/Play/HUD/QuitButton.cs b/osu.Game/Screens/Play/HUD/QuitButton.cs index 29382c25f3..2a4b1f408d 100644 --- a/osu.Game/Screens/Play/HUD/QuitButton.cs +++ b/osu.Game/Screens/Play/HUD/QuitButton.cs @@ -8,7 +8,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 4f3fe15211..f51ea6fe3e 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -5,7 +5,8 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Configuration; diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 721d925d63..5cb5bb152a 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -6,9 +6,10 @@ using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using OpenTK.Graphics; -using osu.Framework.Input; using osu.Framework.Configuration; using osu.Framework.Allocation; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Configuration; using OpenTK; diff --git a/osu.Game/Screens/Play/KeyCounterKeyboard.cs b/osu.Game/Screens/Play/KeyCounterKeyboard.cs index cfa6efbd12..1c2f2c0ac4 100644 --- a/osu.Game/Screens/Play/KeyCounterKeyboard.cs +++ b/osu.Game/Screens/Play/KeyCounterKeyboard.cs @@ -1,7 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using OpenTK.Input; namespace osu.Game.Screens.Play diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index 7c680efcba..20cc53caee 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -1,7 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using OpenTK.Input; using OpenTK; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index f28ddb09a2..4f37b59e6e 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -12,7 +12,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Logging; using osu.Framework.Screens; using osu.Framework.Threading; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 6e1c3d24f0..4abc0dfcd9 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -6,7 +6,8 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Framework.Threading; diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index cff3eca895..1813d02d02 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -5,7 +5,8 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index 383addc607..3e946288d9 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -6,7 +6,6 @@ using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; using osu.Framework.Threading; using osu.Framework.Timing; using osu.Game.Graphics; @@ -17,6 +16,8 @@ using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; using osu.Framework.Input.Bindings; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Input.Bindings; namespace osu.Game.Screens.Play diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 3c9a14e1f4..f1721d8941 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -8,7 +8,6 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Game.Configuration; -using osu.Framework.Input; using OpenTK.Input; using osu.Framework.MathUtils; using System.Diagnostics; @@ -18,6 +17,8 @@ using osu.Framework.Caching; using osu.Framework.Threading; using osu.Framework.Configuration; using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Cursor; diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index c5996327b9..6071e163cf 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs index b6dd6cad65..8a0052559e 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs @@ -8,7 +8,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.Framework.MathUtils; using osu.Game.Graphics; using OpenTK; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 278d32b2d5..274b859e82 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -13,8 +13,9 @@ using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Select.Filter; using Container = osu.Framework.Graphics.Containers.Container; -using osu.Framework.Input; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Configuration; using osu.Game.Rulesets; diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index 8f07e0a763..bc4d216f00 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -11,7 +11,8 @@ 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.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Select diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 3fa12283b5..1b0e3a1620 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -8,7 +8,8 @@ using OpenTK.Input; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 19732107c7..95e9dde68e 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs b/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs index 99b0c53835..19cba72f1f 100644 --- a/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs +++ b/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs @@ -3,7 +3,8 @@ using System; using osu.Framework.Graphics; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using OpenTK; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index d789d41ef4..d4cd882433 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -5,7 +5,8 @@ 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.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 234508a195..3cf406fabb 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -12,7 +12,8 @@ using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.Screens; using osu.Framework.Threading; using osu.Game.Beatmaps; diff --git a/osu.Game/Tests/Visual/EditorClockTestCase.cs b/osu.Game/Tests/Visual/EditorClockTestCase.cs index 22f3e5b6df..0ca7ff011f 100644 --- a/osu.Game/Tests/Visual/EditorClockTestCase.cs +++ b/osu.Game/Tests/Visual/EditorClockTestCase.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c8db3e4d66..56a1979382 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 41ffc17fe3f268e2aa55e0721866fe1e15496912 Mon Sep 17 00:00:00 2001 From: VperuS Date: Sat, 21 Jul 2018 13:27:45 +0300 Subject: [PATCH 170/304] Small clarification about to run dotnet restore --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fd0ba838cc..07d9ccf8ad 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Build and run - Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included) - From command line using `dotnet run --project osu.Desktop --framework netcoreapp2.1` -The above methods should automatically do so, but if you run into issues building you may need to restore nuget packages (commonly via `dotnet restore`). +If you run into issues building you may need to restore nuget packages (commonly via `dotnet restore`). VScode users must run `Restore` task from debug tab before attempt to build. # Contributing From 717345f2608b1c43e82f351ff4282db8f8f65495 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Jul 2018 20:00:34 +0200 Subject: [PATCH 171/304] Use full application name --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 07d9ccf8ad..a1932b0fdf 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Build and run - Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included) - From command line using `dotnet run --project osu.Desktop --framework netcoreapp2.1` -If you run into issues building you may need to restore nuget packages (commonly via `dotnet restore`). VScode users must run `Restore` task from debug tab before attempt to build. +If you run into issues building you may need to restore nuget packages (commonly via `dotnet restore`). Visual Studio Code users must run `Restore` task from debug tab before attempt to build. # Contributing From 3c59ccadd05e22af7e8ec7e3dff722e6736ab4dc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Jul 2018 22:19:58 +0200 Subject: [PATCH 172/304] Fix gameplay always skipping to first hitobject time Regresssed with previous build --- 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 4f37b59e6e..e9e353d698 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -139,7 +139,7 @@ namespace osu.Game.Screens.Play adjustableClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; adjustableClock.Seek(AllowLeadIn - ? Math.Min(RulesetContainer.GameplayStartTime, beatmap.HitObjects.First().StartTime - beatmap.BeatmapInfo.AudioLeadIn) + ? Math.Min(0, beatmap.HitObjects.First().StartTime - beatmap.BeatmapInfo.AudioLeadIn) : RulesetContainer.GameplayStartTime); adjustableClock.ProcessFrame(); From 8501967b6a3a61c38a1499e53914a5d5030860a0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Jul 2018 22:47:25 +0200 Subject: [PATCH 173/304] Fix testing regression --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index b94fb42bf0..41c45f00f3 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -54,6 +54,12 @@ namespace osu.Game.Tests.Visual public new BeatmapCarousel Carousel => base.Carousel; } + protected override void Dispose(bool isDisposing) + { + factory.ResetDatabase(); + base.Dispose(isDisposing); + } + [BackgroundDependencyLoader] private void load() { From 479fe983351418fe01f39dc3b62284823f82625f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Jul 2018 22:57:55 +0200 Subject: [PATCH 174/304] Add more prominent sound when skipping --- osu.Game/Screens/Play/SkipOverlay.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index 3e946288d9..06837c9274 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -4,6 +4,8 @@ using System; using osu.Framework; using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Threading; @@ -214,17 +216,21 @@ namespace osu.Game.Screens.Play private Box background; private AspectContainer aspect; + private SampleChannel sampleConfirm; + public Button() { RelativeSizeAxes = Axes.Both; } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, AudioManager audio) { colourNormal = colours.Yellow; colourHover = colours.YellowDark; + sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection"); + Children = new Drawable[] { background = new Box @@ -311,6 +317,8 @@ namespace osu.Game.Screens.Play if (!Enabled) return false; + sampleConfirm.Play(); + box.FlashColour(Color4.White, 500, Easing.OutQuint); aspect.ScaleTo(1.2f, 2000, Easing.OutQuint); From 44a2ae5f9ac83238d151d848580a8ee33bedfdc8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Jul 2018 08:33:47 +0200 Subject: [PATCH 175/304] Fix incorrect variable usage --- 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 e9e353d698..00ba1a8d12 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -139,7 +139,7 @@ namespace osu.Game.Screens.Play adjustableClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; adjustableClock.Seek(AllowLeadIn - ? Math.Min(0, beatmap.HitObjects.First().StartTime - beatmap.BeatmapInfo.AudioLeadIn) + ? Math.Min(0, RulesetContainer.GameplayStartTime - beatmap.BeatmapInfo.AudioLeadIn) : RulesetContainer.GameplayStartTime); adjustableClock.ProcessFrame(); From 82ea4456e42d7dd4b96243f5e97cb78347ecd2d7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Jul 2018 22:47:25 +0200 Subject: [PATCH 176/304] Fix testing regression --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index b94fb42bf0..41c45f00f3 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -54,6 +54,12 @@ namespace osu.Game.Tests.Visual public new BeatmapCarousel Carousel => base.Carousel; } + protected override void Dispose(bool isDisposing) + { + factory.ResetDatabase(); + base.Dispose(isDisposing); + } + [BackgroundDependencyLoader] private void load() { From 2169a473253247b8bddeee98b27b9511b181c6f7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Jul 2018 10:39:43 +0200 Subject: [PATCH 177/304] Prevent fatal failures on delete failures --- osu.Game/Tests/Visual/OsuTestCase.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Tests/Visual/OsuTestCase.cs b/osu.Game/Tests/Visual/OsuTestCase.cs index 8e09ec849c..67a13bd850 100644 --- a/osu.Game/Tests/Visual/OsuTestCase.cs +++ b/osu.Game/Tests/Visual/OsuTestCase.cs @@ -62,7 +62,16 @@ namespace osu.Game.Tests.Visual } if (localStorage.IsValueCreated) - localStorage.Value.DeleteDirectory("."); + { + try + { + localStorage.Value.DeleteDirectory("."); + } + catch + { + // we don't really care if this fails; it will just leave folders lying around from test runs. + } + } } protected override ITestCaseTestRunner CreateRunner() => new OsuTestCaseTestRunner(); From 1b456fd7166a5645d9b3b058a8fbd7783a345518 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Jul 2018 13:11:06 +0200 Subject: [PATCH 178/304] Fix a potential InvalidOperationException when entering song select Closes #3052. --- osu.Game/Screens/Select/Carousel/CarouselGroup.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs index 2118cfdc78..ea461e7bd5 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs @@ -79,8 +79,13 @@ namespace osu.Game.Screens.Select.Carousel public override void Filter(FilterCriteria criteria) { base.Filter(criteria); - InternalChildren.Sort((x, y) => x.CompareTo(criteria, y)); - InternalChildren.ForEach(c => c.Filter(criteria)); + + var children = new List(InternalChildren); + + children.Sort((x, y) => x.CompareTo(criteria, y)); + children.ForEach(c => c.Filter(criteria)); + + InternalChildren = children; } protected virtual void ChildItemStateChanged(CarouselItem item, CarouselItemState value) From dd56a2d95fc15a3db53fbf4ad5d3252e79686072 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Mon, 23 Jul 2018 15:44:10 +0300 Subject: [PATCH 179/304] Apply proposed changes (untested) --- .../Visual/TestCaseLabelledTextBox.cs | 2 +- .../LabelledComponents/LabelledTextBox.cs | 74 +++++++++---------- .../{OsuSetupTextBox.cs => SetupTextBox.cs} | 2 +- 3 files changed, 36 insertions(+), 42 deletions(-) rename osu.Game/Screens/Edit/Screens/Setup/Components/{OsuSetupTextBox.cs => SetupTextBox.cs} (94%) diff --git a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs index a9f0375d39..be11562bb0 100644 --- a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs +++ b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs @@ -28,7 +28,7 @@ namespace osu.Game.Tests.Visual Anchor = Anchor.Centre, Origin = Anchor.Centre, LabelText = "Testing text", - TextBoxPlaceholderText = "This is definitely working as intended", + PlaceholderText = "This is definitely working as intended", Padding = new MarginPadding { Left = 150, Right = 150 } } }; diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index e0c734f764..806e6b6f6d 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -8,29 +8,25 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using System; +using static osu.Framework.Graphics.UserInterface.TextBox; namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { public class LabelledTextBox : CompositeDrawable { - private readonly OsuSetupTextBox textBox; + private readonly SetupTextBox textBox; private readonly Container content; private readonly OsuSpriteText label; - public const float LABEL_CONTAINER_WIDTH = 150; - public const float OUTER_CORNER_RADIUS = 15; - public const float INNER_CORNER_RADIUS = 10; - public const float DEFAULT_HEIGHT = 40; - public const float DEFAULT_LABEL_LEFT_PADDING = 15; - public const float DEFAULT_LABEL_TOP_PADDING = 12; - public const float DEFAULT_LABEL_TEXT_SIZE = 16; + private const float label_container_width = 150; + private const float outer_corner_radius = 15; + private const float inner_corner_radius = 10; + private const float default_height = 40; + private const float default_label_left_padding = 15; + private const float default_label_top_padding = 12; + private const float default_label_text_size = 16; - public event Action TextBoxTextChanged; - - public void TriggerTextBoxTextChanged(string newText) - { - TextBoxTextChanged?.Invoke(newText); - } + public event OnCommitHandler TextBoxTextChanged; private bool readOnly; public bool ReadOnly @@ -65,30 +61,30 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents } } - private string textBoxPlaceholderText; - public string TextBoxPlaceholderText + private string placeholderText; + public string PlaceholderText { - get => textBoxPlaceholderText; + get => placeholderText; set { - textBoxPlaceholderText = value; + placeholderText = value; textBox.PlaceholderText = value; } } - private string textBoxText; - public string TextBoxText + private string text; + public string Text { - get => textBoxText; + get => text; set { - textBoxText = value; + text = value; textBox.Text = value; - TextBoxTextChanged?.Invoke(value); + TextBoxTextChanged?.Invoke(textBox, true); } } - private float height = DEFAULT_HEIGHT; + private float height = default_height; public float Height { get => height; @@ -137,34 +133,32 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents public LabelledTextBox() { Masking = true; - CornerRadius = OUTER_CORNER_RADIUS; + CornerRadius = outer_corner_radius; RelativeSizeAxes = Axes.X; - base.Height = DEFAULT_HEIGHT + Padding.Top; + base.Height = default_height + Padding.Top; InternalChildren = new Drawable[] { new Container { - RelativeSizeAxes = Axes.X, - Height = DEFAULT_HEIGHT, - CornerRadius = OUTER_CORNER_RADIUS, + RelativeSizeAxes = Axes.Both, + CornerRadius = outer_corner_radius, Masking = true, Children = new Drawable[] { new Box { - RelativeSizeAxes = Axes.X, - Height = DEFAULT_HEIGHT, + RelativeSizeAxes = Axes.Both, Colour = OsuColour.FromHex("1c2125"), }, new Container { RelativeSizeAxes = Axes.X, - Height = DEFAULT_HEIGHT, + Height = default_height, Child = new GridContainer { RelativeSizeAxes = Axes.X, - Height = DEFAULT_HEIGHT, + Height = default_height, Content = new[] { new Drawable[] @@ -173,26 +167,26 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, - Padding = new MarginPadding { Left = DEFAULT_LABEL_LEFT_PADDING, Top = DEFAULT_LABEL_TOP_PADDING }, + Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, Colour = Color4.White, - TextSize = DEFAULT_LABEL_TEXT_SIZE, + TextSize = default_label_text_size, Text = LabelText, Font = @"Exo2.0-Bold", }, - textBox = new OsuSetupTextBox + textBox = new SetupTextBox { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, RelativeSizeAxes = Axes.X, - Height = DEFAULT_HEIGHT, + Height = default_height, ReadOnly = ReadOnly, - CornerRadius = INNER_CORNER_RADIUS, + CornerRadius = inner_corner_radius, }, }, }, ColumnDimensions = new[] { - new Dimension(GridSizeMode.Absolute, LABEL_CONTAINER_WIDTH), + new Dimension(GridSizeMode.Absolute, label_container_width), new Dimension() } } @@ -201,7 +195,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents } }; - textBox.OnCommit += delegate { TriggerTextBoxTextChanged(textBox.Text); }; + textBox.OnCommit += (_, a) => TextBoxTextChanged?.Invoke(textBox, a); } } } diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs similarity index 94% rename from osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs rename to osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs index 1a31582291..206170e1eb 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs @@ -9,7 +9,7 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Edit.Screens.Setup.Components { - public class OsuSetupTextBox : OsuTextBox + public class SetupTextBox : OsuTextBox { protected override float LeftRightPadding => 15; From 10656be954aa02a2e67fde0cb2f5d0d3e4b968eb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Jul 2018 16:54:52 +0200 Subject: [PATCH 180/304] Add interpolation to repeat point during sliding --- .../Objects/Drawables/DrawableRepeatPoint.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index 26f3ee6bb4..77f813ae1e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -74,6 +74,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } } + private bool hasRotation; + public void UpdateSnakingPosition(Vector2 start, Vector2 end) { bool isRepeatAtEnd = repeatPoint.RepeatIndex % 2 == 0; @@ -87,15 +89,30 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables int searchStart = isRepeatAtEnd ? curve.Count - 1 : 0; int direction = isRepeatAtEnd ? -1 : 1; + Vector2 aimRotationVector = Vector2.Zero; + // find the next vector2 in the curve which is not equal to our current position to infer a rotation. for (int i = searchStart; i >= 0 && i < curve.Count; i += direction) { if (Precision.AlmostEquals(curve[i], Position)) continue; - Rotation = MathHelper.RadiansToDegrees((float)Math.Atan2(curve[i].Y - Position.Y, curve[i].X - Position.X)); + aimRotationVector = curve[i]; break; } + + float aimRotation = MathHelper.RadiansToDegrees( + (float)Math.Atan2(aimRotationVector.Y - Position.Y, aimRotationVector.X - Position.X)); + + if (!hasRotation || Math.Abs(aimRotation - Rotation) > 180) + { + Rotation = aimRotation; + hasRotation = true; + } + else + { + Rotation = Interpolation.ValueAt(MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 100), Rotation, aimRotation, 0, 600, Easing.OutQuint); + } } } } From a833fa3d924e05df4047d5ba00965819156f4a2a Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 09:19:45 +0300 Subject: [PATCH 181/304] Update framework and apply suggested changes --- .../Setup/Components/LabelledComponents/LabelledTextBox.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 806e6b6f6d..09797e3180 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -26,7 +26,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents private const float default_label_top_padding = 12; private const float default_label_text_size = 16; - public event OnCommitHandler TextBoxTextChanged; + public event OnCommitHandler OnCommit; private bool readOnly; public bool ReadOnly @@ -80,7 +80,6 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { text = value; textBox.Text = value; - TextBoxTextChanged?.Invoke(textBox, true); } } @@ -195,7 +194,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents } }; - textBox.OnCommit += (_, a) => TextBoxTextChanged?.Invoke(textBox, a); + textBox.OnCommit += OnCommit; } } } From 2f452c162cb9b9c09dd21dba9780f6630fdb3270 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 09:21:01 +0300 Subject: [PATCH 182/304] Make text colour white --- .../Screens/Edit/Screens/Setup/Components/SetupTextBox.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs index 206170e1eb..c3938fae9c 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs @@ -12,13 +12,5 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components public class SetupTextBox : OsuTextBox { protected override float LeftRightPadding => 15; - - [BackgroundDependencyLoader] - private void load(OsuColour osuColour) - { - BorderColour = osuColour.Blue; - } - - protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Colour = BorderColour, TextSize = CalculatedTextSize }; } } From 765c6e4eccbe0a3744fd6c3dfca1f42aa1522f34 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 09:46:24 +0300 Subject: [PATCH 183/304] Remove custom text box --- .../LabelledComponents/LabelledTextBox.cs | 5 +++-- .../Screens/Setup/Components/SetupTextBox.cs | 16 ---------------- 2 files changed, 3 insertions(+), 18 deletions(-) delete mode 100644 osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 09797e3180..15723c0eaf 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using System; using static osu.Framework.Graphics.UserInterface.TextBox; @@ -14,7 +15,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { public class LabelledTextBox : CompositeDrawable { - private readonly SetupTextBox textBox; + private readonly OsuTextBox textBox; private readonly Container content; private readonly OsuSpriteText label; @@ -172,7 +173,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents Text = LabelText, Font = @"Exo2.0-Bold", }, - textBox = new SetupTextBox + textBox = new OsuTextBox { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs deleted file mode 100644 index c3938fae9c..0000000000 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs +++ /dev/null @@ -1,16 +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.Allocation; -using osu.Framework.Graphics; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; - -namespace osu.Game.Screens.Edit.Screens.Setup.Components -{ - public class SetupTextBox : OsuTextBox - { - protected override float LeftRightPadding => 15; - } -} From 0e50e4ee346d6e7f1d06e89a7749b72d95cd239c Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 10:10:17 +0300 Subject: [PATCH 184/304] Clean code --- .../LabelledComponents/LabelledTextBox.cs | 82 +++++++++---------- 1 file changed, 38 insertions(+), 44 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 15723c0eaf..5f4e88b52c 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using System; using static osu.Framework.Graphics.UserInterface.TextBox; namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents @@ -132,63 +131,58 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents public LabelledTextBox() { - Masking = true; - CornerRadius = outer_corner_radius; RelativeSizeAxes = Axes.X; base.Height = default_height + Padding.Top; + CornerRadius = outer_corner_radius; + Masking = true; - InternalChildren = new Drawable[] + InternalChild = new Container { - new Container + RelativeSizeAxes = Axes.Both, + CornerRadius = outer_corner_radius, + Masking = true, + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - CornerRadius = outer_corner_radius, - Masking = true, - Children = new Drawable[] + new Box { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.FromHex("1c2125"), - }, - new Container + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex("1c2125"), + }, + new Container + { + RelativeSizeAxes = Axes.X, + Height = default_height, + Child = new GridContainer { RelativeSizeAxes = Axes.X, Height = default_height, - Child = new GridContainer + Content = new[] { - RelativeSizeAxes = Axes.X, - Height = default_height, - Content = new[] + new Drawable[] { - new Drawable[] + label = new OsuSpriteText { - label = new OsuSpriteText - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, - Colour = Color4.White, - TextSize = default_label_text_size, - Text = LabelText, - Font = @"Exo2.0-Bold", - }, - textBox = new OsuTextBox - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - RelativeSizeAxes = Axes.X, - Height = default_height, - ReadOnly = ReadOnly, - CornerRadius = inner_corner_radius, - }, + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, + Colour = Color4.White, + TextSize = default_label_text_size, + Font = @"Exo2.0-Bold", + }, + textBox = new OsuTextBox + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + RelativeSizeAxes = Axes.X, + Height = default_height, + CornerRadius = inner_corner_radius, }, }, - ColumnDimensions = new[] - { - new Dimension(GridSizeMode.Absolute, label_container_width), - new Dimension() - } + }, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, label_container_width), + new Dimension() } } } From ab9340f4be8ab5410177a0eb4b611437177a28b4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jul 2018 11:34:06 +0200 Subject: [PATCH 185/304] Fix usage of culture local ToUpper causing incorrect display on Turkish machines Closes #3098. --- osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | 3 ++- osu.Game/Overlays/Chat/ChannelSection.cs | 3 ++- osu.Game/Overlays/MedalSplash/DrawableMedal.cs | 3 ++- osu.Game/Overlays/Notifications/NotificationSection.cs | 7 ++++--- osu.Game/Overlays/OnScreenDisplay.cs | 5 +++-- osu.Game/Overlays/Settings/SettingsSubsection.cs | 3 ++- osu.Game/Rulesets/Judgements/DrawableJudgement.cs | 3 ++- osu.Game/Screens/Play/Break/BreakInfo.cs | 3 ++- .../Screens/Play/PlayerSettings/PlayerSettingsGroup.cs | 3 ++- osu.Game/Screens/Tournament/Drawings.cs | 3 ++- osu.Game/Screens/Tournament/Group.cs | 5 +++-- 11 files changed, 26 insertions(+), 15 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index 24e6021421..4e92f49937 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Globalization; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -23,7 +24,7 @@ namespace osu.Game.Beatmaps.Drawables if (value == status) return; status = value; - statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpper(); + statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpper(CultureInfo.InvariantCulture); } } diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index 89d9d2231c..2d0c406ef2 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using System.Globalization; using System.Linq; using OpenTK; using osu.Framework.Graphics; @@ -30,7 +31,7 @@ namespace osu.Game.Overlays.Chat public string Header { get { return header.Text; } - set { header.Text = value.ToUpper(); } + set { header.Text = value.ToUpper(CultureInfo.InvariantCulture); } } public IEnumerable Channels diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index ce79e70b1c..222c966a2b 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.Globalization; using osu.Framework; using OpenTK; using osu.Framework.Allocation; @@ -62,7 +63,7 @@ namespace osu.Game.Overlays.MedalSplash { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "Medal Unlocked".ToUpper(), + Text = "Medal Unlocked".ToUpper(CultureInfo.InvariantCulture), TextSize = 24, Font = @"Exo2.0-Light", Alpha = 0f, diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index c166624d2b..1537c65a1f 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; @@ -55,7 +56,7 @@ namespace osu.Game.Overlays.Notifications set { title = value; - if (titleText != null) titleText.Text = title.ToUpper(); + if (titleText != null) titleText.Text = title.ToUpper(CultureInfo.InvariantCulture); } } @@ -101,7 +102,7 @@ namespace osu.Game.Overlays.Notifications { titleText = new OsuSpriteText { - Text = title.ToUpper(), + Text = title.ToUpper(CultureInfo.InvariantCulture), Font = @"Exo2.0-Black", }, countText = new OsuSpriteText @@ -154,7 +155,7 @@ namespace osu.Game.Overlays.Notifications public string Text { get { return text.Text; } - set { text.Text = value.ToUpper(); } + set { text.Text = value.ToUpper(CultureInfo.InvariantCulture); } } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 5a5b90ee25..ba5bb9c49e 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Configuration.Tracking; @@ -176,9 +177,9 @@ namespace osu.Game.Overlays { Schedule(() => { - textLine1.Text = description.Name.ToUpper(); + textLine1.Text = description.Name.ToUpper(CultureInfo.InvariantCulture); textLine2.Text = description.Value; - textLine3.Text = description.Shortcut.ToUpper(); + textLine3.Text = description.Shortcut.ToUpper(CultureInfo.InvariantCulture); if (string.IsNullOrEmpty(textLine3.Text)) textLine3.Text = "NO KEY BOUND"; diff --git a/osu.Game/Overlays/Settings/SettingsSubsection.cs b/osu.Game/Overlays/Settings/SettingsSubsection.cs index 82589a99bd..4498828118 100644 --- a/osu.Game/Overlays/Settings/SettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/SettingsSubsection.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; using System.Collections.Generic; +using System.Globalization; using System.Linq; using osu.Framework.Allocation; @@ -51,7 +52,7 @@ namespace osu.Game.Overlays.Settings { new OsuSpriteText { - Text = Header.ToUpper(), + Text = Header.ToUpper(CultureInfo.InvariantCulture), Margin = new MarginPadding { Bottom = 10, Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS }, Font = @"Exo2.0-Black", }, diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index 74ee025823..6fa10977d0 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.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.Globalization; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Extensions; @@ -51,7 +52,7 @@ namespace osu.Game.Rulesets.Judgements Child = new SkinnableDrawable($"Play/{Judgement.Result}", _ => JudgementText = new OsuSpriteText { - Text = Judgement.Result.GetDescription().ToUpper(), + Text = Judgement.Result.GetDescription().ToUpper(CultureInfo.InvariantCulture), Font = @"Venera", Colour = judgementColour(Judgement.Result), Scale = new Vector2(0.85f, 1), diff --git a/osu.Game/Screens/Play/Break/BreakInfo.cs b/osu.Game/Screens/Play/Break/BreakInfo.cs index 77c9c967b4..fb7f6cd03b 100644 --- a/osu.Game/Screens/Play/Break/BreakInfo.cs +++ b/osu.Game/Screens/Play/Break/BreakInfo.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.Globalization; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -28,7 +29,7 @@ namespace osu.Game.Screens.Play.Break { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "current progress".ToUpper(), + Text = "current progress".ToUpper(CultureInfo.InvariantCulture), TextSize = 15, Font = "Exo2.0-Black", }, diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index 1813d02d02..9a17e7708b 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.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.Globalization; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -94,7 +95,7 @@ namespace osu.Game.Screens.Play.PlayerSettings { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Text = Title.ToUpper(), + Text = Title.ToUpper(CultureInfo.InvariantCulture), TextSize = 17, Font = @"Exo2.0-Bold", Margin = new MarginPadding { Left = 10 }, diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 49a46b96e3..7bc8217329 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -323,7 +324,7 @@ namespace osu.Game.Screens.Tournament if (string.IsNullOrEmpty(line)) continue; - if (line.ToUpper().StartsWith("GROUP")) + if (line.ToUpper(CultureInfo.InvariantCulture).StartsWith("GROUP")) continue; // ReSharper disable once AccessToModifiedClosure diff --git a/osu.Game/Screens/Tournament/Group.cs b/osu.Game/Screens/Tournament/Group.cs index b1bcd6052c..f62c26a62e 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game/Screens/Tournament/Group.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Text; using osu.Framework.Allocation; @@ -51,7 +52,7 @@ namespace osu.Game.Screens.Tournament Position = new Vector2(0, 7f), - Text = $"GROUP {name.ToUpper()}", + Text = $"GROUP {name.ToUpper(CultureInfo.InvariantCulture)}", TextSize = 8f, Font = @"Exo2.0-Bold", Colour = new Color4(255, 204, 34, 255), @@ -161,7 +162,7 @@ namespace osu.Game.Screens.Tournament Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = team.Acronym.ToUpper(), + Text = team.Acronym.ToUpper(CultureInfo.InvariantCulture), TextSize = 10f, Font = @"Exo2.0-Bold" } From b38da34da9df8e8910e293a3a93766b58aab4bf0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jul 2018 12:11:14 +0200 Subject: [PATCH 186/304] Fix resetting database failing due to incorrect disposal logic --- osu.Game/Database/DatabaseContextFactory.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Database/DatabaseContextFactory.cs b/osu.Game/Database/DatabaseContextFactory.cs index c20d4569f6..e70d753114 100644 --- a/osu.Game/Database/DatabaseContextFactory.cs +++ b/osu.Game/Database/DatabaseContextFactory.cs @@ -5,6 +5,7 @@ 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 @@ -115,7 +116,11 @@ namespace osu.Game.Database } } - private void recycleThreadContexts() => threadContexts = new ThreadLocal(CreateContext); + private void recycleThreadContexts() + { + threadContexts?.Values.ForEach(c => c.Dispose()); + threadContexts = new ThreadLocal(CreateContext, true); + } protected virtual OsuDbContext CreateContext() => new OsuDbContext(storage.GetDatabaseConnectionString(database_name)) { @@ -127,8 +132,6 @@ namespace osu.Game.Database lock (writeLock) { recycleThreadContexts(); - GC.Collect(); - GC.WaitForPendingFinalizers(); storage.DeleteDatabase(database_name); } } From 1d86083981b80ee725645ce9b10719c384a9687a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jul 2018 12:11:20 +0200 Subject: [PATCH 187/304] Hide unnecessary log output --- osu.Game/OsuGameBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 63cc883844..bada2a794d 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -224,7 +224,7 @@ namespace osu.Game // todo: we probably want a better (non-destructive) migrations/recovery process at a later point than this. contextFactory.ResetDatabase(); - Logger.Log("Database purged successfully.", LoggingTarget.Database, LogLevel.Important); + Logger.Log("Database purged successfully.", LoggingTarget.Database); // only run once more, then hard bail. using (var db = contextFactory.GetForWrite(false)) From 5364a6148a2b6adcbd77fbde14359cc1d6b9b259 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jul 2018 14:42:06 +0200 Subject: [PATCH 188/304] Use ToUpperInvariant --- osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | 3 +-- osu.Game/Overlays/Chat/ChannelSection.cs | 3 +-- osu.Game/Overlays/MedalSplash/DrawableMedal.cs | 3 +-- osu.Game/Overlays/Notifications/NotificationSection.cs | 7 +++---- osu.Game/Overlays/OnScreenDisplay.cs | 5 ++--- osu.Game/Overlays/Settings/SettingsSubsection.cs | 3 +-- osu.Game/Rulesets/Judgements/DrawableJudgement.cs | 3 +-- osu.Game/Screens/Play/Break/BreakInfo.cs | 3 +-- .../Screens/Play/PlayerSettings/PlayerSettingsGroup.cs | 3 +-- osu.Game/Screens/Tournament/Drawings.cs | 3 +-- osu.Game/Screens/Tournament/Group.cs | 5 ++--- 11 files changed, 15 insertions(+), 26 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index 4e92f49937..c7e97cef55 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Globalization; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -24,7 +23,7 @@ namespace osu.Game.Beatmaps.Drawables if (value == status) return; status = value; - statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpper(CultureInfo.InvariantCulture); + statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpperInvariant(); } } diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index 2d0c406ef2..85fdecaaba 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.Globalization; using System.Linq; using OpenTK; using osu.Framework.Graphics; @@ -31,7 +30,7 @@ namespace osu.Game.Overlays.Chat public string Header { get { return header.Text; } - set { header.Text = value.ToUpper(CultureInfo.InvariantCulture); } + set { header.Text = value.ToUpperInvariant(); } } public IEnumerable Channels diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index 222c966a2b..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.Globalization; using osu.Framework; using OpenTK; using osu.Framework.Allocation; @@ -63,7 +62,7 @@ namespace osu.Game.Overlays.MedalSplash { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "Medal Unlocked".ToUpper(CultureInfo.InvariantCulture), + Text = "Medal Unlocked".ToUpperInvariant(), TextSize = 24, Font = @"Exo2.0-Light", Alpha = 0f, diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index 1537c65a1f..f41e3e876f 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; @@ -56,7 +55,7 @@ namespace osu.Game.Overlays.Notifications set { title = value; - if (titleText != null) titleText.Text = title.ToUpper(CultureInfo.InvariantCulture); + if (titleText != null) titleText.Text = title.ToUpperInvariant(); } } @@ -102,7 +101,7 @@ namespace osu.Game.Overlays.Notifications { titleText = new OsuSpriteText { - Text = title.ToUpper(CultureInfo.InvariantCulture), + Text = title.ToUpperInvariant(), Font = @"Exo2.0-Black", }, countText = new OsuSpriteText @@ -155,7 +154,7 @@ namespace osu.Game.Overlays.Notifications public string Text { get { return text.Text; } - set { text.Text = value.ToUpper(CultureInfo.InvariantCulture); } + set { text.Text = value.ToUpperInvariant(); } } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index ba5bb9c49e..041ceab365 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Configuration.Tracking; @@ -177,9 +176,9 @@ namespace osu.Game.Overlays { Schedule(() => { - textLine1.Text = description.Name.ToUpper(CultureInfo.InvariantCulture); + textLine1.Text = description.Name.ToUpperInvariant(); textLine2.Text = description.Value; - textLine3.Text = description.Shortcut.ToUpper(CultureInfo.InvariantCulture); + textLine3.Text = description.Shortcut.ToUpperInvariant(); if (string.IsNullOrEmpty(textLine3.Text)) textLine3.Text = "NO KEY BOUND"; diff --git a/osu.Game/Overlays/Settings/SettingsSubsection.cs b/osu.Game/Overlays/Settings/SettingsSubsection.cs index 4498828118..9296972749 100644 --- a/osu.Game/Overlays/Settings/SettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/SettingsSubsection.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; using System.Collections.Generic; -using System.Globalization; using System.Linq; using osu.Framework.Allocation; @@ -52,7 +51,7 @@ namespace osu.Game.Overlays.Settings { new OsuSpriteText { - Text = Header.ToUpper(CultureInfo.InvariantCulture), + Text = Header.ToUpperInvariant(), Margin = new MarginPadding { Bottom = 10, Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS }, Font = @"Exo2.0-Black", }, diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index 6fa10977d0..5de14ae579 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.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.Globalization; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Extensions; @@ -52,7 +51,7 @@ namespace osu.Game.Rulesets.Judgements Child = new SkinnableDrawable($"Play/{Judgement.Result}", _ => JudgementText = new OsuSpriteText { - Text = Judgement.Result.GetDescription().ToUpper(CultureInfo.InvariantCulture), + Text = Judgement.Result.GetDescription().ToUpperInvariant(), Font = @"Venera", Colour = judgementColour(Judgement.Result), Scale = new Vector2(0.85f, 1), diff --git a/osu.Game/Screens/Play/Break/BreakInfo.cs b/osu.Game/Screens/Play/Break/BreakInfo.cs index fb7f6cd03b..51d39762d2 100644 --- a/osu.Game/Screens/Play/Break/BreakInfo.cs +++ b/osu.Game/Screens/Play/Break/BreakInfo.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.Globalization; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -29,7 +28,7 @@ namespace osu.Game.Screens.Play.Break { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "current progress".ToUpper(CultureInfo.InvariantCulture), + Text = "current progress".ToUpperInvariant(), TextSize = 15, Font = "Exo2.0-Black", }, diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index 9a17e7708b..c4767f404d 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.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.Globalization; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -95,7 +94,7 @@ namespace osu.Game.Screens.Play.PlayerSettings { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Text = Title.ToUpper(CultureInfo.InvariantCulture), + Text = Title.ToUpperInvariant(), TextSize = 17, Font = @"Exo2.0-Bold", Margin = new MarginPadding { Left = 10 }, diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 7bc8217329..63d29d5cd7 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -324,7 +323,7 @@ namespace osu.Game.Screens.Tournament if (string.IsNullOrEmpty(line)) continue; - if (line.ToUpper(CultureInfo.InvariantCulture).StartsWith("GROUP")) + if (line.ToUpperInvariant().StartsWith("GROUP")) continue; // ReSharper disable once AccessToModifiedClosure diff --git a/osu.Game/Screens/Tournament/Group.cs b/osu.Game/Screens/Tournament/Group.cs index f62c26a62e..6845d8fc48 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game/Screens/Tournament/Group.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.Globalization; using System.Linq; using System.Text; using osu.Framework.Allocation; @@ -52,7 +51,7 @@ namespace osu.Game.Screens.Tournament Position = new Vector2(0, 7f), - Text = $"GROUP {name.ToUpper(CultureInfo.InvariantCulture)}", + Text = $"GROUP {name.ToUpperInvariant()}", TextSize = 8f, Font = @"Exo2.0-Bold", Colour = new Color4(255, 204, 34, 255), @@ -162,7 +161,7 @@ namespace osu.Game.Screens.Tournament Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = team.Acronym.ToUpper(CultureInfo.InvariantCulture), + Text = team.Acronym.ToUpperInvariant(), TextSize = 10f, Font = @"Exo2.0-Bold" } From 3ca112aef0779c29fd7eaeca0dd9d9d24656e661 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 22:04:02 +0300 Subject: [PATCH 189/304] Clean code and apply requested changes --- .../LabelledComponents/LabelledTextBox.cs | 124 ++++++------------ 1 file changed, 39 insertions(+), 85 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 5f4e88b52c..9f364c6cf4 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -27,82 +27,41 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents private const float default_label_text_size = 16; public event OnCommitHandler OnCommit; - - private bool readOnly; + public bool ReadOnly { - get => readOnly; - set - { - textBox.ReadOnly = value; - readOnly = value; - } + get => textBox.ReadOnly; + set => textBox.ReadOnly = value; } - - private string labelText; + public string LabelText { - get => labelText; - set - { - labelText = value; - label.Text = value; - } + get => label.Text; + set => label.Text = value; } - - private float labelTextSize; + public float LabelTextSize { - get => labelTextSize; - set - { - labelTextSize = value; - label.TextSize = value; - } + get => label.TextSize; + set => label.TextSize = value; } - - private string placeholderText; + public string PlaceholderText { - get => placeholderText; - set - { - placeholderText = value; - textBox.PlaceholderText = value; - } + get => textBox.PlaceholderText; + set => textBox.PlaceholderText = value; } - private string text; public string Text { - get => text; - set - { - text = value; - textBox.Text = value; - } - } - - private float height = default_height; - public float Height - { - get => height; - private set - { - height = value; - textBox.Height = value; - content.Height = value; - } + get => textBox.Text; + set => textBox.Text = value; } public MarginPadding Padding { get => base.Padding; - set - { - base.Padding = value; - base.Height = Height + base.Padding.Top; - } + set => base.Padding = value; } public MarginPadding LabelPadding @@ -132,7 +91,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents public LabelledTextBox() { RelativeSizeAxes = Axes.X; - base.Height = default_height + Padding.Top; + Height = default_height; CornerRadius = outer_corner_radius; Masking = true; @@ -148,42 +107,37 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents RelativeSizeAxes = Axes.Both, Colour = OsuColour.FromHex("1c2125"), }, - new Container + new GridContainer { RelativeSizeAxes = Axes.X, Height = default_height, - Child = new GridContainer + Content = new[] { - RelativeSizeAxes = Axes.X, - Height = default_height, - Content = new[] + new Drawable[] { - new Drawable[] + label = new OsuSpriteText { - label = new OsuSpriteText - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, - Colour = Color4.White, - TextSize = default_label_text_size, - Font = @"Exo2.0-Bold", - }, - textBox = new OsuTextBox - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - RelativeSizeAxes = Axes.X, - Height = default_height, - CornerRadius = inner_corner_radius, - }, + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, + Colour = Color4.White, + TextSize = default_label_text_size, + Font = @"Exo2.0-Bold", + }, + textBox = new OsuTextBox + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + RelativeSizeAxes = Axes.Both, + Height = 1, + CornerRadius = inner_corner_radius, }, }, - ColumnDimensions = new[] - { - new Dimension(GridSizeMode.Absolute, label_container_width), - new Dimension() - } + }, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, label_container_width), + new Dimension() } } } From 6675c455f3d6761343b969849db8d92d376238c5 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 22:33:19 +0300 Subject: [PATCH 190/304] Trim whitespace that magically appeared --- .../Components/LabelledComponents/LabelledTextBox.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 9f364c6cf4..fbfb771c8a 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -27,25 +27,25 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents private const float default_label_text_size = 16; public event OnCommitHandler OnCommit; - + public bool ReadOnly { get => textBox.ReadOnly; set => textBox.ReadOnly = value; } - + public string LabelText { get => label.Text; set => label.Text = value; } - + public float LabelTextSize { get => label.TextSize; set => label.TextSize = value; } - + public string PlaceholderText { get => textBox.PlaceholderText; From da8fc0ee5dd169946155aa4150bf34354c14255e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Jul 2018 07:37:05 +0200 Subject: [PATCH 191/304] ToLower -> ToLowerInvariant --- osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs | 4 ++-- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 2 +- osu.Game/Graphics/ScreenshotManager.cs | 2 +- osu.Game/Online/API/Requests/GetUserScoresRequest.cs | 2 +- osu.Game/Online/API/Requests/PostMessageRequest.cs | 2 +- osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs | 2 +- osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 4 ++-- osu.Game/Screens/Multi/Header.cs | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs index 64ed08373a..fdc8f362f7 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs @@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Mania.Tests return new ScrollingTestContainer(direction) { AutoSizeAxes = Axes.Both, - Child = new NoteContainer(direction, $"note, scrolling {direction.ToString().ToLower()}") + Child = new NoteContainer(direction, $"note, scrolling {direction.ToString().ToLowerInvariant()}") { Child = new DrawableNote(note) { AccentColour = Color4.OrangeRed } } @@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Mania.Tests return new ScrollingTestContainer(direction) { AutoSizeAxes = Axes.Both, - Child = new NoteContainer(direction, $"hold note, scrolling {direction.ToString().ToLower()}") + Child = new NoteContainer(direction, $"hold note, scrolling {direction.ToString().ToLowerInvariant()}") { Child = new DrawableHoldNote(note) { diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 52d9f31814..26f28c86ca 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -312,7 +312,7 @@ namespace osu.Game.Beatmaps.Formats omitFirstBarSignature = effectFlags.HasFlag(EffectFlags.OmitFirstBarLine); } - string stringSampleSet = sampleSet.ToString().ToLower(); + string stringSampleSet = sampleSet.ToString().ToLowerInvariant(); if (stringSampleSet == @"none") stringSampleSet = @"normal"; diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index 90580c50df..7b3337cb23 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -134,7 +134,7 @@ namespace osu.Game.Graphics private string getFileName() { var dt = DateTime.Now; - var fileExt = screenshotFormat.ToString().ToLower(); + var fileExt = screenshotFormat.ToString().ToLowerInvariant(); var withoutIndex = $"osu_{dt:yyyy-MM-dd_HH-mm-ss}.{fileExt}"; if (!storage.Exists(withoutIndex)) diff --git a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs index ea14135a61..4d4aa4d957 100644 --- a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs @@ -20,7 +20,7 @@ namespace osu.Game.Online.API.Requests } // ReSharper disable once ImpureMethodCallOnReadonlyValueField - protected override string Target => $@"users/{userId}/scores/{type.ToString().ToLower()}?offset={offset}"; + protected override string Target => $@"users/{userId}/scores/{type.ToString().ToLowerInvariant()}?offset={offset}"; } public enum ScoreType diff --git a/osu.Game/Online/API/Requests/PostMessageRequest.cs b/osu.Game/Online/API/Requests/PostMessageRequest.cs index 44429bdcd5..e0a9fb83b2 100644 --- a/osu.Game/Online/API/Requests/PostMessageRequest.cs +++ b/osu.Game/Online/API/Requests/PostMessageRequest.cs @@ -23,7 +23,7 @@ namespace osu.Game.Online.API.Requests req.Method = HttpMethod.POST; req.AddParameter(@"target_type", message.TargetType.GetDescription()); req.AddParameter(@"target_id", message.TargetId.ToString()); - req.AddParameter(@"is_action", message.IsAction.ToString().ToLower()); + req.AddParameter(@"is_action", message.IsAction.ToString().ToLowerInvariant()); req.AddParameter(@"message", message.Content); return req; diff --git a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs index 2a154d1230..3c808d1bee 100644 --- a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs @@ -29,7 +29,7 @@ namespace osu.Game.Online.API.Requests } // ReSharper disable once ImpureMethodCallOnReadonlyValueField - protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)searchCategory}&sort={sortCriteria.ToString().ToLower()}_{directionString}"; + protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)searchCategory}&sort={sortCriteria.ToString().ToLowerInvariant()}_{directionString}"; } public enum BeatmapSearchCategory diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 0ac8e585f8..c48060bfa9 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -197,10 +197,10 @@ namespace osu.Game.Rulesets.Objects.Legacy var bank = (LegacyBeatmapDecoder.LegacySampleBank)int.Parse(split[0]); var addbank = (LegacyBeatmapDecoder.LegacySampleBank)int.Parse(split[1]); - string stringBank = bank.ToString().ToLower(); + string stringBank = bank.ToString().ToLowerInvariant(); if (stringBank == @"none") stringBank = null; - string stringAddBank = addbank.ToString().ToLower(); + string stringAddBank = addbank.ToString().ToLowerInvariant(); if (stringAddBank == @"none") stringAddBank = null; diff --git a/osu.Game/Screens/Multi/Header.cs b/osu.Game/Screens/Multi/Header.cs index 46610a36d8..809fc25083 100644 --- a/osu.Game/Screens/Multi/Header.cs +++ b/osu.Game/Screens/Multi/Header.cs @@ -86,7 +86,7 @@ namespace osu.Game.Screens.Multi }, }; - breadcrumbs.Current.ValueChanged += s => screenType.Text = ((MultiplayerScreen)s).Type.ToLower(); + breadcrumbs.Current.ValueChanged += s => screenType.Text = ((MultiplayerScreen)s).Type.ToLowerInvariant(); breadcrumbs.Current.TriggerChange(); } From b60e4b0728cc24a0067d673c6552f12de6e331e9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 25 Jul 2018 18:34:47 +0900 Subject: [PATCH 192/304] Cleanup --- .../Components/LabelledComponents/LabelledTextBox.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index fbfb771c8a..4c8e90400a 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -5,19 +5,15 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using static osu.Framework.Graphics.UserInterface.TextBox; namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { public class LabelledTextBox : CompositeDrawable { - private readonly OsuTextBox textBox; - private readonly Container content; - private readonly OsuSpriteText label; - private const float label_container_width = 150; private const float outer_corner_radius = 15; private const float inner_corner_radius = 10; @@ -26,7 +22,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents private const float default_label_top_padding = 12; private const float default_label_text_size = 16; - public event OnCommitHandler OnCommit; + public event TextBox.OnCommitHandler OnCommit; public bool ReadOnly { @@ -88,6 +84,10 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents set => content.Colour = value; } + private readonly OsuTextBox textBox; + private readonly Container content; + private readonly OsuSpriteText label; + public LabelledTextBox() { RelativeSizeAxes = Axes.X; From 206e3686f2dc2fd98273892f6d5faeee4dfad304 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 25 Jul 2018 18:38:50 +0900 Subject: [PATCH 193/304] Add back blue border --- .../Setup/Components/LabelledComponents/LabelledTextBox.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 4c8e90400a..736d785b41 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.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 osu.Framework.Allocation; using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -145,5 +146,11 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents textBox.OnCommit += OnCommit; } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + textBox.BorderColour = colours.Blue; + } } } From c4b1ba2979ede6c0b00c29c6912801ad6e4d0adf Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Wed, 25 Jul 2018 15:14:40 +0300 Subject: [PATCH 194/304] Remove padding, fix corner radiuses --- .../Visual/TestCaseLabelledTextBox.cs | 10 ++++--- .../LabelledComponents/LabelledTextBox.cs | 27 +++---------------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs index be11562bb0..d41739bfb5 100644 --- a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs +++ b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs @@ -4,6 +4,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents; using System; using System.Collections.Generic; @@ -21,15 +22,18 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load() { - Children = new Drawable[] + Child = new Container { - new LabelledTextBox + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + Padding = new MarginPadding { Left = 150, Right = 150 }, + Child = new LabelledTextBox { Anchor = Anchor.Centre, Origin = Anchor.Centre, LabelText = "Testing text", PlaceholderText = "This is definitely working as intended", - Padding = new MarginPadding { Left = 150, Right = 150 } } }; } diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 736d785b41..94200b7f4e 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -16,8 +16,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents public class LabelledTextBox : CompositeDrawable { private const float label_container_width = 150; - private const float outer_corner_radius = 15; - private const float inner_corner_radius = 10; + private const float corner_radius = 15; private const float default_height = 40; private const float default_label_left_padding = 15; private const float default_label_top_padding = 12; @@ -55,24 +54,6 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents set => textBox.Text = value; } - public MarginPadding Padding - { - get => base.Padding; - set => base.Padding = value; - } - - public MarginPadding LabelPadding - { - get => label.Padding; - set => label.Padding = value; - } - - public MarginPadding TextBoxPadding - { - get => textBox.Padding; - set => textBox.Padding = value; - } - public Color4 LabelTextColour { get => label.Colour; @@ -93,13 +74,13 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { RelativeSizeAxes = Axes.X; Height = default_height; - CornerRadius = outer_corner_radius; + CornerRadius = corner_radius; Masking = true; InternalChild = new Container { RelativeSizeAxes = Axes.Both, - CornerRadius = outer_corner_radius, + CornerRadius = corner_radius, Masking = true, Children = new Drawable[] { @@ -131,7 +112,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents Origin = Anchor.TopLeft, RelativeSizeAxes = Axes.Both, Height = 1, - CornerRadius = inner_corner_radius, + CornerRadius = corner_radius, }, }, }, From ee0522ad8416ed2147c1346ad756b3b31ea1ab97 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Jul 2018 16:45:07 +0200 Subject: [PATCH 195/304] Ignore failing test --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index d56b6d04f7..b1ffe04b68 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -120,6 +120,7 @@ namespace osu.Game.Tests.Visual } [Test] + [Ignore("needs fixing")] public void ImportUnderDifferentRuleset() { changeRuleset(2); From ff2a3a6e9208c6d3fb7324cecea974eef9d2785f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 26 Jul 2018 20:07:16 +0900 Subject: [PATCH 196/304] Fix hitobjects not properly expiring if scrolling in the editor --- .../Objects/Drawables/DrawableOsuHitObject.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 02def2189f..5dc141bed0 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -1,11 +1,13 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.ComponentModel; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Graphics; using System.Linq; using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; using OpenTK.Graphics; @@ -32,7 +34,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { UpdatePreemptState(); - using (BeginDelayedSequence(HitObject.TimePreempt + (Judgements.FirstOrDefault()?.TimeOffset ?? 0), true)) + var judgementOffset = Math.Min(HitObject.HitWindows.HalfWindowFor(HitResult.Miss), Judgements.FirstOrDefault()?.TimeOffset ?? 0); + + using (BeginDelayedSequence(HitObject.TimePreempt + judgementOffset, true)) UpdateCurrentState(state); } } From 71c49de0312c769922b91250a1de42eb8f7f5831 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 26 Jul 2018 21:00:18 +0900 Subject: [PATCH 197/304] Fix possible nullref if no fruits are ever caught --- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 2f42902fd0..7b06426b07 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -52,6 +52,9 @@ namespace osu.Game.Rulesets.Catch.UI { void runAfterLoaded(Action action) { + if (lastPlateableFruit == null) + return; + // this is required to make this run after the last caught fruit runs UpdateState at least once. // TODO: find a better alternative if (lastPlateableFruit.IsLoaded) From d32a3ff0524696cf274edb1649632e08340cce64 Mon Sep 17 00:00:00 2001 From: phosphene47 Date: Sat, 28 Jul 2018 08:34:51 +1000 Subject: [PATCH 198/304] Esc at the end of play should push to result screen Closes #3060 --- osu.Game/Screens/Play/Player.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 00ba1a8d12..438e5a49e0 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -278,6 +278,8 @@ namespace osu.Game.Screens.Play ScoreProcessor.PopulateScore(score); score.User = RulesetContainer.Replay?.User ?? api.LocalUser.Value; Push(new Results(score)); + + onCompletionEvent = null; }); } } @@ -340,6 +342,14 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(Screen next) { + if (onCompletionEvent != null) + { + // Proceed to result screen if beatmap already finished playing + onCompletionEvent.RunTask(); + + return true; + } + if ((!AllowPause || HasFailed || !ValidForResume || pauseContainer?.IsPaused != false || RulesetContainer?.HasReplayLoaded != false) && (!pauseContainer?.IsResuming ?? true)) { // In the case of replays, we may have changed the playback rate. From 2a9818a1281f8ad6d8567e395ea0e92c04d92b22 Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Sun, 29 Jul 2018 20:42:05 +0200 Subject: [PATCH 199/304] Add support for sliderscorepoint skinning --- .../Objects/Drawables/DrawableSliderTick.cs | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index db75321eb0..a5ecb63d12 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -8,6 +8,8 @@ using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; +using osu.Game.Skinning; +using osu.Framework.Graphics.Containers; namespace osu.Game.Rulesets.Osu.Objects.Drawables { @@ -22,23 +24,27 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public DrawableSliderTick(SliderTick sliderTick) : base(sliderTick) { Size = new Vector2(16) * sliderTick.Scale; - - Masking = true; - CornerRadius = Size.X / 2; - Origin = Anchor.Centre; - BorderThickness = 2; - BorderColour = Color4.White; - InternalChildren = new Drawable[] { - new Box + new SkinnableDrawable("Play/osu/sliderscorepoint", _ => new Container { + Masking = true, RelativeSizeAxes = Axes.Both, - Colour = AccentColour, - Alpha = 0.3f, - } + Origin = Anchor.Centre, + CornerRadius = Size.X / 2, + + BorderThickness = 2, + BorderColour = Color4.White, + + Child = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = AccentColour, + Alpha = 0.3f, + } + }, restrictSize: false) }; } From 52d9461f03c549b5ea565efa0656d5c2c0d05dee Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Sun, 29 Jul 2018 20:51:06 +0200 Subject: [PATCH 200/304] Add support for reversearrow skinning --- .../Objects/Drawables/DrawableRepeatPoint.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index 26f3ee6bb4..ec6b312a80 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -10,6 +10,7 @@ using OpenTK; using osu.Game.Graphics; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; +using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Objects.Drawables { @@ -33,11 +34,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables InternalChildren = new Drawable[] { - new SpriteIcon + new SkinnableDrawable("Play/osu/reversearrow", _ => new SpriteIcon { RelativeSizeAxes = Axes.Both, Icon = FontAwesome.fa_chevron_right - } + }, restrictSize: false) }; } From 257c035f30d6d11299de92fdff604622af2f5471 Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Sun, 29 Jul 2018 21:28:13 +0200 Subject: [PATCH 201/304] Add support for sliderfollowcircle skinning --- .../Objects/Drawables/Pieces/SliderBall.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 92c42af861..17a90dc369 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -10,6 +10,7 @@ using osu.Framework.Input.States; using osu.Game.Rulesets.Objects.Types; using OpenTK; using OpenTK.Graphics; +using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { @@ -33,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces } private readonly Slider slider; - public readonly Box FollowCircle; + public readonly Drawable FollowCircle; private readonly Box ball; public SliderBall(Slider slider) @@ -46,13 +47,17 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces BorderThickness = 10; BorderColour = Color4.Orange; - Children = new Drawable[] + Children = new[] { - FollowCircle = new Box + FollowCircle = new Container { + Child = new SkinnableDrawable("Play/osu/sliderfollowcircle", _ => new Box + { + Colour = Color4.Orange, + RelativeSizeAxes = Axes.Both, + }, restrictSize: false), Origin = Anchor.Centre, Anchor = Anchor.Centre, - Colour = Color4.Orange, Width = width, Height = width, Alpha = 0, From 4322475ad2bd5ef4aea7ff20de9cab38e09ed20f Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Sun, 29 Jul 2018 22:29:07 +0200 Subject: [PATCH 202/304] Add support for sliderb skinning (single frame only) --- .../Objects/Drawables/Pieces/SliderBall.cs | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 17a90dc369..1191ed2fda 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -28,14 +28,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces set { accentColour = value; - if (ball != null) - ball.Colour = value; + if (drawableBall != null) + drawableBall.Colour = value; } } private readonly Slider slider; public readonly Drawable FollowCircle; - private readonly Box ball; + private Drawable drawableBall; public SliderBall(Slider slider) { @@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { Colour = Color4.Orange, RelativeSizeAxes = Axes.Both, - }, restrictSize: false), + }), Origin = Anchor.Centre, Anchor = Anchor.Centre, Width = width, @@ -68,18 +68,26 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces AutoSizeAxes = Axes.Both, Origin = Anchor.Centre, Anchor = Anchor.Centre, - BorderThickness = 10, - BorderColour = Color4.White, Alpha = 1, - Children = new[] + Child = new Container { - ball = new Box + Width = width, + Height = width, + // TODO: support skin filename animation (sliderb0, sliderb1...) + Child = new SkinnableDrawable("Play/osu/sliderb", _ => new CircularContainer { - Colour = AccentColour, - Alpha = 0.4f, - Width = width, - Height = width, - }, + Masking = true, + RelativeSizeAxes = Axes.Both, + BorderThickness = 10, + BorderColour = Color4.White, + Alpha = 1, + Child = drawableBall = new Box + { + Colour = AccentColour, + RelativeSizeAxes = Axes.Both, + Alpha = 0.4f, + } + }), } } }; From 18096490b6c16ca22f1de0022f4047a12d22b830 Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Sun, 29 Jul 2018 23:20:37 +0200 Subject: [PATCH 203/304] Add support for followpoint skinning --- .../Drawables/Connections/FollowPoint.cs | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs index 2c89ddc9cf..1c486d5d1e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs @@ -7,6 +7,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections { @@ -20,26 +21,27 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections { Origin = Anchor.Centre; - Masking = true; - AutoSizeAxes = Axes.Both; - CornerRadius = width / 2; - EdgeEffect = new EdgeEffectParameters + Child = new SkinnableDrawable("Play/osu/followpoint", _ => new Container { - Type = EdgeEffectType.Glow, - Colour = Color4.White.Opacity(0.2f), - Radius = 4, - }; - - Children = new Drawable[] - { - new Box + Masking = true, + AutoSizeAxes = Axes.Both, + CornerRadius = width / 2, + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Glow, + Colour = Color4.White.Opacity(0.2f), + Radius = 4, + }, + Child = new Box { Size = new Vector2(width), Blending = BlendingMode.Additive, Origin = Anchor.Centre, Anchor = Anchor.Centre, - Alpha = 0.5f, - }, + } + }, restrictSize: false) + { + Alpha = 0.5f, }; } } From 84135c49cae1522abb388154e32c1f481f40647f Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Sun, 29 Jul 2018 23:21:05 +0200 Subject: [PATCH 204/304] Fix small FollowPoint rotation bug --- .../Objects/Drawables/Connections/FollowPointRenderer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs index 4ac3b0c983..61a6e6404a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs @@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections Vector2 distanceVector = endPosition - startPosition; int distance = (int)distanceVector.Length; - float rotation = (float)Math.Atan2(distanceVector.Y, distanceVector.X); + float rotation = (float)(Math.Atan2(distanceVector.Y, distanceVector.X) * (180 / Math.PI)); double duration = endTime - startTime; for (int d = (int)(PointDistance * 1.5); d < distance - PointDistance; d += PointDistance) From f57ba4ffb17634c6e43a47ba063f4d5dc4dc32b2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jul 2018 13:00:24 +0900 Subject: [PATCH 205/304] 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 56a1979382..85e9e7e181 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 0205916b9ec4325b5b0371955107d834dc8740af Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jul 2018 14:39:45 +0900 Subject: [PATCH 206/304] Revert "Specify tests directly" This reverts commit 1502edcdc6f2b194a088225c2dbfbb32b91727e8. --- appveyor.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4545feade0..27f1484e32 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,8 +17,6 @@ build: project: osu.sln parallel: true verbosity: minimal -test_script: - - cmd: dotnet test --configuration Debug --no-build --test-adapter-path:. --logger:Appveyor after_build: - cmd: inspectcode --o="inspectcodereport.xml" --projects:osu.Game* --caches-home="inspectcode" osu.sln > NUL - cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors From 8c3583ac54a9e98f48ff4fb073635410002883a7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jul 2018 14:55:03 +0900 Subject: [PATCH 207/304] Remove newline --- osu.Game/Screens/Play/Player.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 438e5a49e0..cc649960ea 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -346,7 +346,6 @@ namespace osu.Game.Screens.Play { // Proceed to result screen if beatmap already finished playing onCompletionEvent.RunTask(); - return true; } From 338496452d0e0600053b25d35d166b2ddf45e476 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jul 2018 15:15:51 +0900 Subject: [PATCH 208/304] Move testing package references to somewhere appveyor will find them --- .../osu.Game.Rulesets.Catch.Tests.csproj | 6 ++++++ .../osu.Game.Rulesets.Mania.Tests.csproj | 6 ++++++ .../osu.Game.Rulesets.Osu.Tests.csproj | 6 ++++++ .../osu.Game.Rulesets.Taiko.Tests.csproj | 6 ++++++ osu.Game.Tests/osu.Game.Tests.csproj | 6 ++++++ osu.TestProject.props | 4 ---- 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj index 66c81dc14d..9bef8f258c 100644 --- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj +++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj @@ -1,5 +1,11 @@  + + + + + + WinExe netcoreapp2.1 diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj index 7427862c0d..61057a64a1 100644 --- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj +++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj @@ -1,5 +1,11 @@  + + + + + + WinExe netcoreapp2.1 diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj index 0d0e023e2a..9e10a556a4 100644 --- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj +++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj @@ -1,5 +1,11 @@  + + + + + + WinExe netcoreapp2.1 diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj index 3c38a48be6..0e29da1549 100644 --- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj +++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj @@ -1,5 +1,11 @@  + + + + + + WinExe netcoreapp2.1 diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 066df5418a..478a06ed30 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -1,5 +1,11 @@  + + + + + + WinExe netcoreapp2.1 diff --git a/osu.TestProject.props b/osu.TestProject.props index 1369af4aee..a73a4f8ce2 100644 --- a/osu.TestProject.props +++ b/osu.TestProject.props @@ -13,10 +13,6 @@ - - - - From c6aabc6d2d60a4eb29e0a4847e178a26502e787b Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Mon, 30 Jul 2018 10:52:37 +0200 Subject: [PATCH 209/304] Move the FollowCircle border to its own container --- .../Objects/Drawables/Pieces/SliderBall.cs | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 1191ed2fda..0c6e49ca1b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -35,6 +35,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private readonly Slider slider; public readonly Drawable FollowCircle; + private Drawable fadeFollowCircle; private Drawable drawableBall; public SliderBall(Slider slider) @@ -44,23 +45,29 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces AutoSizeAxes = Axes.Both; Blending = BlendingMode.Additive; Origin = Anchor.Centre; - BorderThickness = 10; - BorderColour = Color4.Orange; Children = new[] { FollowCircle = new Container { - Child = new SkinnableDrawable("Play/osu/sliderfollowcircle", _ => new Box - { - Colour = Color4.Orange, - RelativeSizeAxes = Axes.Both, - }), Origin = Anchor.Centre, Anchor = Anchor.Centre, Width = width, Height = width, - Alpha = 0, + Child = new SkinnableDrawable("Play/osu/sliderfollowcircle", _ => new CircularContainer + { + RelativeSizeAxes = Axes.Both, + Masking = true, + BorderThickness = 5, + BorderColour = Color4.Orange, + Blending = BlendingMode.Additive, + Child = fadeFollowCircle = new Box + { + Colour = Color4.Orange, + RelativeSizeAxes = Axes.Both, + Alpha = 0, + } + }), }, new CircularContainer { @@ -134,7 +141,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces tracking = value; FollowCircle.ScaleTo(tracking ? 2.8f : 1, 300, Easing.OutQuint); - FollowCircle.FadeTo(tracking ? 0.2f : 0, 300, Easing.OutQuint); + fadeFollowCircle?.FadeTo(tracking ? 0.2f : 0, 300, Easing.OutQuint); } } From 95aa6b262d0fb1165a2446e71debb20c09e529ec Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 30 Jul 2018 16:01:02 +0900 Subject: [PATCH 210/304] Use .NET Core CFS --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 7c08eb9e9c..e1691f0708 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,9 +9,9 @@ install: - cmd: git submodule update --init --recursive --depth=5 - cmd: choco install resharper-clt -y - cmd: choco install nvika -y - - cmd: appveyor DownloadFile https://github.com/peppy/CodeFileSanity/releases/download/v0.2.5/CodeFileSanity.exe + - cmd: dotnet tool install CodeFileSanity --version 13.0.0 --global --add-source https://ci.appveyor.com/nuget/codefilesanity before_build: - - cmd: CodeFileSanity.exe + - cmd: codefilesanity - cmd: nuget restore -verbosity quiet environment: TargetFramework: net471 From f4cda695e6b3fc43b2034a8af22f33e06265bb39 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jul 2018 18:50:59 +0900 Subject: [PATCH 211/304] Improve rotation handling in edge cases --- .../Objects/Drawables/DrawableRepeatPoint.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index 77f813ae1e..27ec6cc529 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -101,17 +101,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables break; } - float aimRotation = MathHelper.RadiansToDegrees( - (float)Math.Atan2(aimRotationVector.Y - Position.Y, aimRotationVector.X - Position.X)); + float aimRotation = MathHelper.RadiansToDegrees((float)Math.Atan2(aimRotationVector.Y - Position.Y, aimRotationVector.X - Position.X)); + while (Math.Abs(aimRotation - Rotation) > 180) + aimRotation += aimRotation < Rotation ? 360 : -360; - if (!hasRotation || Math.Abs(aimRotation - Rotation) > 180) + if (!hasRotation) { Rotation = aimRotation; hasRotation = true; } else { - Rotation = Interpolation.ValueAt(MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 100), Rotation, aimRotation, 0, 600, Easing.OutQuint); + Rotation = Interpolation.ValueAt(MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 100), Rotation, aimRotation, 0, 50, Easing.OutQuint); } } } From 21f3ff6e7717b346ba7ebb7f0f9810dac4dc55a7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jul 2018 18:51:25 +0900 Subject: [PATCH 212/304] Fix slider repeat points appearing far too late --- osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs index 0b729f0956..3495bc1b4b 100644 --- a/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs @@ -16,6 +16,9 @@ namespace osu.Game.Rulesets.Osu.Objects { base.ApplyDefaultsToSelf(controlPointInfo, difficulty); + // Out preempt should be one span early to give the user ample warning. + TimePreempt += SpanDuration; + // We want to show the first RepeatPoint as the TimePreempt dictates but on short (and possibly fast) sliders // we may need to cut down this time on following RepeatPoints to only show up to two RepeatPoints at any given time. if (RepeatIndex > 0) From 36afae5a2427be890c49b71aede6f17cd0af8a1e Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Mon, 30 Jul 2018 13:43:02 +0200 Subject: [PATCH 213/304] Remove the inner followcircle fade, Fade the entire followcircle instead --- .../Objects/Drawables/Pieces/SliderBall.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 0c6e49ca1b..8fdfbbef7a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -35,7 +35,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private readonly Slider slider; public readonly Drawable FollowCircle; - private Drawable fadeFollowCircle; private Drawable drawableBall; public SliderBall(Slider slider) @@ -54,6 +53,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces Anchor = Anchor.Centre, Width = width, Height = width, + Alpha = 0, Child = new SkinnableDrawable("Play/osu/sliderfollowcircle", _ => new CircularContainer { RelativeSizeAxes = Axes.Both, @@ -61,11 +61,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces BorderThickness = 5, BorderColour = Color4.Orange, Blending = BlendingMode.Additive, - Child = fadeFollowCircle = new Box + Child = new Box { Colour = Color4.Orange, RelativeSizeAxes = Axes.Both, - Alpha = 0, + Alpha = 0.2f, } }), }, @@ -141,7 +141,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces tracking = value; FollowCircle.ScaleTo(tracking ? 2.8f : 1, 300, Easing.OutQuint); - fadeFollowCircle?.FadeTo(tracking ? 0.2f : 0, 300, Easing.OutQuint); + FollowCircle.FadeTo(tracking ? 1f : 0, 300, Easing.OutQuint); } } From d9435d24a6270e3a123fc9edc4c7c0c789ea2b20 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 Jul 2018 12:35:33 +0900 Subject: [PATCH 214/304] Use nuget version --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index e1691f0708..58e22633d0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,7 +9,7 @@ install: - cmd: git submodule update --init --recursive --depth=5 - cmd: choco install resharper-clt -y - cmd: choco install nvika -y - - cmd: dotnet tool install CodeFileSanity --version 13.0.0 --global --add-source https://ci.appveyor.com/nuget/codefilesanity + - cmd: dotnet tool install CodeFileSanity --version 0.0.16 --global before_build: - cmd: codefilesanity - cmd: nuget restore -verbosity quiet From 64b2189df88a795811aa573deaa6cf5ad1d79f36 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 Jul 2018 12:50:49 +0900 Subject: [PATCH 215/304] Fix case, just in case --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 58e22633d0..36bc79324d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,7 +11,7 @@ install: - cmd: choco install nvika -y - cmd: dotnet tool install CodeFileSanity --version 0.0.16 --global before_build: - - cmd: codefilesanity + - cmd: CodeFileSanity - cmd: nuget restore -verbosity quiet environment: TargetFramework: net471 From ae8bf34fd1df55510646b5e90d6f218925ee92ea Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 31 Jul 2018 13:42:47 +0900 Subject: [PATCH 216/304] Fix breadcrumb testcase failures --- .../Visual/TestCaseScreenBreadcrumbControl.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs b/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs index 83bbbfddd1..b70117a3ad 100644 --- a/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs +++ b/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs @@ -54,11 +54,11 @@ namespace osu.Game.Tests.Visual breadcrumbs.Current.TriggerChange(); - assertCurrent(); + waitForCurrent(); pushNext(); - assertCurrent(); + waitForCurrent(); pushNext(); - assertCurrent(); + waitForCurrent(); AddStep(@"make start current", () => { @@ -66,8 +66,9 @@ namespace osu.Game.Tests.Visual currentScreen = startScreen; }); - assertCurrent(); + waitForCurrent(); pushNext(); + waitForCurrent(); AddAssert(@"only 2 items", () => breadcrumbs.Items.Count() == 2); AddStep(@"exit current", () => changedScreen.Exit()); AddAssert(@"current screen is first", () => startScreen == changedScreen); @@ -80,7 +81,7 @@ namespace osu.Game.Tests.Visual } private void pushNext() => AddStep(@"push next screen", () => currentScreen = ((TestScreen)currentScreen).PushNext()); - private void assertCurrent() => AddAssert(@"changedScreen correct", () => currentScreen == changedScreen); + private void waitForCurrent() => AddUntilStep(() => currentScreen.IsCurrentScreen, "current screen"); private abstract class TestScreen : OsuScreen { From 70338e087a356d3dde16bcc2c548286fa28695c7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 31 Jul 2018 14:41:31 +0900 Subject: [PATCH 217/304] Disable beatmap download button if not supporter --- .../BeatmapSet/Buttons/DownloadButton.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs index 223ca1c904..7cfacc9475 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs @@ -1,18 +1,25 @@ // 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.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Online.API; +using osu.Game.Users; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Overlays.BeatmapSet.Buttons { public class DownloadButton : HeaderButton { + private readonly IBindable localUser = new Bindable(); + public DownloadButton(BeatmapSetInfo set, bool noVideo = false) { Width = 120; @@ -86,5 +93,17 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons } }; } + + [BackgroundDependencyLoader] + private void load(APIAccess api) + { + localUser.BindTo(api.LocalUser); + localUser.BindValueChanged(userChanged, true); + Enabled.BindValueChanged(enabledChanged, true); + } + + private void userChanged(User user) => Enabled.Value = user.IsSupporter; + + private void enabledChanged(bool enabled) => this.FadeColour(enabled ? Color4.White : Color4.Gray, 200, Easing.OutQuint); } } From ec31028f1461a6e3c697d636232c80bb722efc56 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 31 Jul 2018 14:50:57 +0900 Subject: [PATCH 218/304] Add tooltip --- osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs index 7cfacc9475..f3e49f68b1 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; @@ -16,8 +17,10 @@ using OpenTK.Graphics; namespace osu.Game.Overlays.BeatmapSet.Buttons { - public class DownloadButton : HeaderButton + public class DownloadButton : HeaderButton, IHasTooltip { + public string TooltipText => Enabled ? null : "You gotta be an osu!supporter to download for now 'yo"; + private readonly IBindable localUser = new Bindable(); public DownloadButton(BeatmapSetInfo set, bool noVideo = false) From a98bb057e2b9d9a5b284abe53ce203812ff16bb3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 Jul 2018 15:19:55 +0900 Subject: [PATCH 219/304] Fix follow circle being scaled far larger than it should be --- osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 92c42af861..cb28241454 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -120,7 +120,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces return; tracking = value; - FollowCircle.ScaleTo(tracking ? 2.8f : 1, 300, Easing.OutQuint); + FollowCircle.ScaleTo(tracking ? 2f : 1, 300, Easing.OutQuint); FollowCircle.FadeTo(tracking ? 0.2f : 0, 300, Easing.OutQuint); } } From 132241424db9f438c102f2a7aeae41675c3754ed Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 Jul 2018 15:59:06 +0900 Subject: [PATCH 220/304] Apply FollowPoint alpha to inner container (should not affect legacy skins) --- .../Objects/Drawables/Connections/FollowPoint.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs index 1c486d5d1e..908b9cb3c6 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs @@ -38,11 +38,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections Blending = BlendingMode.Additive, Origin = Anchor.Centre, Anchor = Anchor.Centre, + Alpha = 0.5f, } - }, restrictSize: false) - { - Alpha = 0.5f, - }; + }, restrictSize: false); } } } From 976653fdf95d7f337a274057530c2f543a2b5fe4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 Jul 2018 16:13:52 +0900 Subject: [PATCH 221/304] Minor formatting fixes --- osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 8fdfbbef7a..4560444f69 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -19,6 +19,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private const float width = 128; private Color4 accentColour = Color4.Black; + /// /// The colour that is used for the slider ball. /// @@ -131,6 +132,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces } private bool tracking; + public bool Tracking { get { return tracking; } From 9ab56bc4ef94853d26e9fa3dddaf6911561aeafa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 Jul 2018 16:35:51 +0900 Subject: [PATCH 222/304] Make Ruleset non-public --- osu.Game/Screens/Select/SongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 6f5dba7e76..1bcd65e30b 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -69,7 +69,7 @@ namespace osu.Game.Screens.Select private SampleChannel sampleChangeDifficulty; private SampleChannel sampleChangeBeatmap; - public new readonly Bindable Ruleset = new Bindable(); + protected new readonly Bindable Ruleset = new Bindable(); private DependencyContainer dependencies; From ea6cab498edf877a040190d358db6d4392767852 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 Jul 2018 16:47:13 +0900 Subject: [PATCH 223/304] Add comment --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index 27ec6cc529..0fba62eb60 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -101,6 +101,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables break; } + float aimRotation = MathHelper.RadiansToDegrees((float)Math.Atan2(aimRotationVector.Y - Position.Y, aimRotationVector.X - Position.X)); while (Math.Abs(aimRotation - Rotation) > 180) aimRotation += aimRotation < Rotation ? 360 : -360; @@ -112,6 +113,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } else { + // If we're already snaking, interpolate to smooth out sharp curves (linear sliders, mainly). Rotation = Interpolation.ValueAt(MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 100), Rotation, aimRotation, 0, 50, Easing.OutQuint); } } From 3c06655672ca01929f224c5e286c2f5104dae989 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 Jul 2018 18:00:42 +0900 Subject: [PATCH 224/304] Split out Special mods into Automation and Conversion --- osu.Game.Rulesets.Catch/CatchRuleset.cs | 6 +- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 6 +- osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.cs | 1 + .../Mods/ManiaModDualStages.cs | 1 + .../Mods/ManiaModMirror.cs | 2 +- .../Mods/ManiaModRandom.cs | 1 + osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs | 1 + osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs | 1 + osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs | 1 + osu.Game.Rulesets.Osu/OsuRuleset.cs | 12 +- osu.Game.Rulesets.Taiko/TaikoRuleset.cs | 6 +- osu.Game.Tests/Visual/TestCaseMods.cs | 9 +- osu.Game/Overlays/Mods/ModSection.cs | 13 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 264 +++++++++--------- .../AutomationSection.cs} | 12 +- .../Mods/Sections/ConversionSection.cs | 27 ++ .../DifficultyIncreaseSection.cs | 4 +- .../DifficultyReductionSection.cs | 4 +- osu.Game/Overlays/Mods/Sections/FunSection.cs | 27 ++ osu.Game/Rulesets/Mods/Mod.cs | 2 +- osu.Game/Rulesets/Mods/ModAutoplay.cs | 1 + osu.Game/Rulesets/Mods/ModRelax.cs | 1 + osu.Game/Rulesets/Mods/ModType.cs | 4 +- osu.Game/Rulesets/UI/ModIcon.cs | 15 +- 24 files changed, 250 insertions(+), 171 deletions(-) rename osu.Game/Overlays/Mods/{SpecialSection.cs => Sections/AutomationSection.cs} (71%) create mode 100644 osu.Game/Overlays/Mods/Sections/ConversionSection.cs rename osu.Game/Overlays/Mods/{ => Sections}/DifficultyIncreaseSection.cs (94%) rename osu.Game/Overlays/Mods/{ => Sections}/DifficultyReductionSection.cs (94%) create mode 100644 osu.Game/Overlays/Mods/Sections/FunSection.cs diff --git a/osu.Game.Rulesets.Catch/CatchRuleset.cs b/osu.Game.Rulesets.Catch/CatchRuleset.cs index fc6e23c884..1f1d2475f6 100644 --- a/osu.Game.Rulesets.Catch/CatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/CatchRuleset.cs @@ -93,13 +93,11 @@ namespace osu.Game.Rulesets.Catch new CatchModHidden(), new CatchModFlashlight(), }; - case ModType.Special: + case ModType.Automation: return new Mod[] { - new CatchModRelax(), - null, - null, new MultiMod(new CatchModAutoplay(), new ModCinema()), + new CatchModRelax(), }; default: return new Mod[] { }; diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 3d58e63da5..1cd1714705 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -120,7 +120,7 @@ namespace osu.Game.Rulesets.Mania new MultiMod(new ManiaModFadeIn(), new ManiaModHidden()), new ManiaModFlashlight(), }; - case ModType.Special: + case ModType.Conversion: return new Mod[] { new MultiMod(new ManiaModKey4(), @@ -135,6 +135,10 @@ namespace osu.Game.Rulesets.Mania new ManiaModRandom(), new ManiaModDualStages(), new ManiaModMirror(), + }; + case ModType.Automation: + return new Mod[] + { new MultiMod(new ManiaModAutoplay(), new ModCinema()), }; default: diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.cs b/osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.cs index 6bfe295c3d..6d91c03c13 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.cs @@ -13,6 +13,7 @@ namespace osu.Game.Rulesets.Mania.Mods { public override string ShortenedName => Name; public abstract int KeyCount { get; } + public override ModType Type => ModType.Conversion; public override double ScoreMultiplier => 1; // TODO: Implement the mania key mod score multiplier public override bool Ranked => true; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs index 256811b4c1..aecfb50fbe 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs @@ -16,6 +16,7 @@ namespace osu.Game.Rulesets.Mania.Mods public override string Name => "Dual Stages"; public override string ShortenedName => "DS"; public override string Description => @"Double the stages, double the fun!"; + public override ModType Type => ModType.Conversion; public override double ScoreMultiplier => 1; private bool isForCurrentRuleset; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs index 4192ec78da..847b0037f1 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Mania.Mods { public override string Name => "Mirror"; public override string ShortenedName => "MR"; - public override ModType Type => ModType.Special; + public override ModType Type => ModType.Conversion; public override double ScoreMultiplier => 1; public override bool Ranked => true; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs index 2f951461c3..0915b80742 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs @@ -16,6 +16,7 @@ namespace osu.Game.Rulesets.Mania.Mods { public override string Name => "Random"; public override string ShortenedName => "RD"; + public override ModType Type => ModType.Conversion; public override FontAwesome Icon => FontAwesome.fa_osu_dice; public override string Description => @"Shuffle around the keys!"; public override double ScoreMultiplier => 1; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs index b2ddd65e38..37d5f57fcb 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs @@ -12,6 +12,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Name => "Autopilot"; public override string ShortenedName => "AP"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_autopilot; + public override ModType Type => ModType.Automation; public override string Description => @"Automatic cursor movement - just follow the rhythm."; public override double ScoreMultiplier => 1; public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail), typeof(ModAutoplay) }; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs b/osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs index d14af57bab..6aa864d9b2 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs @@ -12,6 +12,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Name => "Spun Out"; public override string ShortenedName => "SO"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_spunout; + public override ModType Type => ModType.DifficultyReduction; public override string Description => @"Spinners will be automatically completed."; public override double ScoreMultiplier => 0.9; public override bool Ranked => true; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs index ce53857a09..139ce4cc4b 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs @@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Osu.Mods { public override string Name => "Target"; public override string ShortenedName => "TP"; + public override ModType Type => ModType.Conversion; public override FontAwesome Icon => FontAwesome.fa_osu_mod_target; public override string Description => @"Practice keeping up with the beat of the song."; public override double ScoreMultiplier => 1; diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index b8ba1e2945..fa6e9a018a 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -94,6 +94,7 @@ namespace osu.Game.Rulesets.Osu new OsuModEasy(), new OsuModNoFail(), new MultiMod(new OsuModHalfTime(), new OsuModDaycore()), + new OsuModSpunOut(), }; case ModType.DifficultyIncrease: return new Mod[] @@ -104,14 +105,17 @@ namespace osu.Game.Rulesets.Osu new OsuModHidden(), new OsuModFlashlight(), }; - case ModType.Special: + case ModType.Conversion: return new Mod[] { + new OsuModTarget(), + }; + case ModType.Automation: + return new Mod[] + { + new MultiMod(new OsuModAutoplay(), new ModCinema()), new OsuModRelax(), new OsuModAutopilot(), - new OsuModSpunOut(), - new MultiMod(new OsuModAutoplay(), new ModCinema()), - new OsuModTarget(), }; default: return new Mod[] { }; diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs index 609fd27bb4..7d9bc98957 100644 --- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -93,13 +93,11 @@ namespace osu.Game.Rulesets.Taiko new TaikoModHidden(), new TaikoModFlashlight(), }; - case ModType.Special: + case ModType.Automation: return new Mod[] { - new TaikoModRelax(), - null, - null, new MultiMod(new TaikoModAutoplay(), new ModCinema()), + new TaikoModRelax(), }; default: return new Mod[] { }; diff --git a/osu.Game.Tests/Visual/TestCaseMods.cs b/osu.Game.Tests/Visual/TestCaseMods.cs index 1a28442e38..cc396a63e3 100644 --- a/osu.Game.Tests/Visual/TestCaseMods.cs +++ b/osu.Game.Tests/Visual/TestCaseMods.cs @@ -16,6 +16,7 @@ using System.Collections.Generic; using osu.Game.Rulesets.Osu; using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.Sprites; +using osu.Game.Overlays.Mods.Sections; using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Mania.Mods; using osu.Game.Rulesets.UI; @@ -36,7 +37,9 @@ namespace osu.Game.Tests.Visual typeof(ModButtonEmpty), typeof(DifficultyReductionSection), typeof(DifficultyIncreaseSection), - typeof(SpecialSection), + typeof(AutomationSection), + typeof(ConversionSection), + typeof(FunSection), }; private RulesetStore rulesets; @@ -95,7 +98,7 @@ namespace osu.Game.Tests.Visual { var easierMods = ruleset.GetModsFor(ModType.DifficultyReduction); var harderMods = ruleset.GetModsFor(ModType.DifficultyIncrease); - var assistMods = ruleset.GetModsFor(ModType.Special); + var assistMods = ruleset.GetModsFor(ModType.Automation); var noFailMod = easierMods.FirstOrDefault(m => m is OsuModNoFail); var hiddenMod = harderMods.FirstOrDefault(m => m is OsuModHidden); @@ -119,7 +122,7 @@ namespace osu.Game.Tests.Visual private void testManiaMods(ManiaRuleset ruleset) { - testRankedText(ruleset.GetModsFor(ModType.Special).First(m => m is ManiaModRandom)); + testRankedText(ruleset.GetModsFor(ModType.Conversion).First(m => m is ManiaModRandom)); } private void testSingleMod(Mod mod) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 2fb44bb927..16ae070c1c 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -73,9 +73,12 @@ namespace osu.Game.Overlays.Mods protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { - var index = Array.IndexOf(ToggleKeys, args.Key); - if (index > -1 && index < buttons.Length) - buttons[index].SelectNext(state.Keyboard.ShiftPressed ? -1 : 1); + if (ToggleKeys != null) + { + var index = Array.IndexOf(ToggleKeys, args.Key); + if (index > -1 && index < buttons.Length) + buttons[index].SelectNext(state.Keyboard.ShiftPressed ? -1 : 1); + } return base.OnKeyDown(state, args); } @@ -125,6 +128,10 @@ namespace osu.Game.Overlays.Mods protected ModSection() { AutoSizeAxes = Axes.Y; + RelativeSizeAxes = Axes.X; + + Origin = Anchor.TopCentre; + Anchor = Anchor.TopCentre; Children = new Drawable[] { diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 98cf111ba0..4745eba68d 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -21,6 +21,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; using osu.Game.Rulesets; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.Mods.Sections; namespace osu.Game.Overlays.Mods { @@ -188,6 +189,7 @@ namespace osu.Game.Overlays.Mods Waves.FourthWaveColour = OsuColour.FromHex(@"003a4e"); Height = 510; + Children = new Drawable[] { new Container @@ -211,178 +213,172 @@ namespace osu.Game.Overlays.Mods }, }, }, - new FillFlowContainer + new GridContainer { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.Both, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0f, 10f), - Children = new Drawable[] + RowDimensions = new[] { - // Header - new Container + new Dimension(GridSizeMode.Absolute, 90), + new Dimension(GridSizeMode.Distributed), + new Dimension(GridSizeMode.Absolute, 70), + }, + Content = new[] + { + new Drawable[] { - RelativeSizeAxes = Axes.X, - Height = 82, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Children = new Drawable[] + new Container { - new Box + RelativeSizeAxes = Axes.Both, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.Gray(10).Opacity(100), - }, - new FillFlowContainer - { - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Width = content_width, - Padding = new MarginPadding + new Box { - Top = 10, - Bottom = 10, + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(10).Opacity(100), }, - Children = new Drawable[] + new FillFlowContainer { - new OsuSpriteText + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Width = content_width, + Children = new Drawable[] { - Font = @"Exo2.0-Bold", - Text = @"Gameplay Mods", - TextSize = 22, - Shadow = true, - Margin = new MarginPadding + new OsuSpriteText { - Bottom = 4, + Font = @"Exo2.0-Bold", + Text = @"Gameplay Mods", + TextSize = 22, + Shadow = true, + Margin = new MarginPadding + { + Bottom = 4, + }, + }, + new OsuTextFlowContainer(text => + { + text.TextSize = 18; + text.Shadow = true; + }) + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Text = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.\nOthers are just for fun.", }, - }, - new OsuSpriteText - { - Text = @"Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.", - TextSize = 18, - Shadow = true, - }, - new OsuSpriteText - { - Text = @"Others are just for fun.", - TextSize = 18, - Shadow = true, }, }, }, }, }, - // Body - ModSectionsContainer = new FillFlowContainer + new Drawable[] { - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Spacing = new Vector2(0f, 10f), - Width = content_width, - Children = new ModSection[] + // Body + new OsuScrollContainer { - new DifficultyReductionSection + ScrollbarVisible = false, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Vertical = 10 }, + Child = ModSectionsContainer = new FillFlowContainer { - RelativeSizeAxes = Axes.X, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, - Action = modButtonPressed, - }, - new DifficultyIncreaseSection - { RelativeSizeAxes = Axes.X, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Action = modButtonPressed, - }, - new SpecialSection - { - RelativeSizeAxes = Axes.X, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Action = modButtonPressed, - }, - } - }, - // Footer - new Container - { - RelativeSizeAxes = Axes.X, - Height = 70, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = new Color4(172, 20, 116, 255), - Alpha = 0.5f, - }, - footerContainer = new FillFlowContainer - { - Origin = Anchor.BottomCentre, - Anchor = Anchor.BottomCentre, AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, + Spacing = new Vector2(0f, 10f), Width = content_width, - Direction = FillDirection.Horizontal, - Padding = new MarginPadding + Children = new ModSection[] { - Vertical = 15 + new DifficultyReductionSection { Action = modButtonPressed }, + new DifficultyIncreaseSection { Action = modButtonPressed }, + new AutomationSection { Action = modButtonPressed }, + new ConversionSection { Action = modButtonPressed }, + new FunSection { Action = modButtonPressed }, + } + }, + }, + }, + new Drawable[] + { + // Footer + new Container + { + RelativeSizeAxes = Axes.Both, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = new Color4(172, 20, 116, 255), + Alpha = 0.5f, }, - Children = new Drawable[] + footerContainer = new FillFlowContainer { - DeselectAllButton = new TriangleButton + Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomCentre, + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Width = content_width, + Direction = FillDirection.Horizontal, + Padding = new MarginPadding { - Width = 180, - Text = "Deselect All", - Action = DeselectAll, - Margin = new MarginPadding - { - Right = 20 - } + Vertical = 15 }, - new OsuSpriteText + Children = new Drawable[] { - Text = @"Score Multiplier:", - TextSize = 30, - Margin = new MarginPadding + DeselectAllButton = new TriangleButton { - Top = 5, - Right = 10 - } - }, - MultiplierLabel = new OsuSpriteText - { - Font = @"Exo2.0-Bold", - TextSize = 30, - Margin = new MarginPadding + Width = 180, + Text = "Deselect All", + Action = DeselectAll, + Margin = new MarginPadding + { + Right = 20 + } + }, + new OsuSpriteText { - Top = 5 - } - }, - UnrankedLabel = new OsuSpriteText - { - Font = @"Exo2.0-Bold", - Text = @"(Unranked)", - TextSize = 30, - Margin = new MarginPadding + Text = @"Score Multiplier:", + TextSize = 30, + Margin = new MarginPadding + { + Top = 5, + Right = 10 + } + }, + MultiplierLabel = new OsuSpriteText { - Top = 5, - Left = 10 + Font = @"Exo2.0-Bold", + TextSize = 30, + Margin = new MarginPadding + { + Top = 5 + } + }, + UnrankedLabel = new OsuSpriteText + { + Font = @"Exo2.0-Bold", + Text = @"(Unranked)", + TextSize = 30, + Margin = new MarginPadding + { + Top = 5, + Left = 10 + } } } } - } - }, + }, + } }, }, }, diff --git a/osu.Game/Overlays/Mods/SpecialSection.cs b/osu.Game/Overlays/Mods/Sections/AutomationSection.cs similarity index 71% rename from osu.Game/Overlays/Mods/SpecialSection.cs rename to osu.Game/Overlays/Mods/Sections/AutomationSection.cs index b3540cf915..6d3b1fe7e6 100644 --- a/osu.Game/Overlays/Mods/SpecialSection.cs +++ b/osu.Game/Overlays/Mods/Sections/AutomationSection.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.Input; using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; +using OpenTK.Input; -namespace osu.Game.Overlays.Mods +namespace osu.Game.Overlays.Mods.Sections { - public class SpecialSection : ModSection + public class AutomationSection : ModSection { protected override Key[] ToggleKeys => new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }; - public override ModType ModType => ModType.Special; + public override ModType ModType => ModType.Automation; [BackgroundDependencyLoader] private void load(OsuColour colours) @@ -19,9 +19,9 @@ namespace osu.Game.Overlays.Mods SelectedColour = colours.BlueLight; } - public SpecialSection() + public AutomationSection() { - Header = @"Special"; + Header = @"Automation"; } } } diff --git a/osu.Game/Overlays/Mods/Sections/ConversionSection.cs b/osu.Game/Overlays/Mods/Sections/ConversionSection.cs new file mode 100644 index 0000000000..c757a59073 --- /dev/null +++ b/osu.Game/Overlays/Mods/Sections/ConversionSection.cs @@ -0,0 +1,27 @@ +// 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.Game.Graphics; +using osu.Game.Rulesets.Mods; +using OpenTK.Input; + +namespace osu.Game.Overlays.Mods.Sections +{ + public class ConversionSection : ModSection + { + protected override Key[] ToggleKeys => null; + public override ModType ModType => ModType.Conversion; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + SelectedColour = colours.Purple; + } + + public ConversionSection() + { + Header = @"Conversion"; + } + } +} diff --git a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs b/osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs similarity index 94% rename from osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs rename to osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs index d7d9a90e77..ed585cff22 100644 --- a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs +++ b/osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs @@ -1,12 +1,12 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; +using OpenTK.Input; -namespace osu.Game.Overlays.Mods +namespace osu.Game.Overlays.Mods.Sections { public class DifficultyIncreaseSection : ModSection { diff --git a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs b/osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs similarity index 94% rename from osu.Game/Overlays/Mods/DifficultyReductionSection.cs rename to osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs index 013deea579..4aa8b1f16f 100644 --- a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs +++ b/osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs @@ -1,12 +1,12 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; +using OpenTK.Input; -namespace osu.Game.Overlays.Mods +namespace osu.Game.Overlays.Mods.Sections { public class DifficultyReductionSection : ModSection { diff --git a/osu.Game/Overlays/Mods/Sections/FunSection.cs b/osu.Game/Overlays/Mods/Sections/FunSection.cs new file mode 100644 index 0000000000..ec6d469329 --- /dev/null +++ b/osu.Game/Overlays/Mods/Sections/FunSection.cs @@ -0,0 +1,27 @@ +// 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.Game.Graphics; +using osu.Game.Rulesets.Mods; +using OpenTK.Input; + +namespace osu.Game.Overlays.Mods.Sections +{ + public class FunSection : ModSection + { + protected override Key[] ToggleKeys => null; + public override ModType ModType => ModType.Fun; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + SelectedColour = colours.PinkLight; + } + + public FunSection() + { + Header = @"Fun"; + } + } +} diff --git a/osu.Game/Rulesets/Mods/Mod.cs b/osu.Game/Rulesets/Mods/Mod.cs index 9fb554b5c5..a991f7e7b0 100644 --- a/osu.Game/Rulesets/Mods/Mod.cs +++ b/osu.Game/Rulesets/Mods/Mod.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Mods /// /// The type of this mod. /// - public virtual ModType Type => ModType.Special; + public virtual ModType Type => ModType.Fun; /// /// The user readable description of this mod. diff --git a/osu.Game/Rulesets/Mods/ModAutoplay.cs b/osu.Game/Rulesets/Mods/ModAutoplay.cs index 8f73ff4c2d..5c03cb9736 100644 --- a/osu.Game/Rulesets/Mods/ModAutoplay.cs +++ b/osu.Game/Rulesets/Mods/ModAutoplay.cs @@ -26,6 +26,7 @@ namespace osu.Game.Rulesets.Mods public override string Name => "Autoplay"; public override string ShortenedName => "AT"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_auto; + public override ModType Type => ModType.Automation; public override string Description => "Watch a perfect automated play through the song."; public override double ScoreMultiplier => 1; public bool AllowFail => false; diff --git a/osu.Game/Rulesets/Mods/ModRelax.cs b/osu.Game/Rulesets/Mods/ModRelax.cs index 0bd9becd78..04aa295893 100644 --- a/osu.Game/Rulesets/Mods/ModRelax.cs +++ b/osu.Game/Rulesets/Mods/ModRelax.cs @@ -11,6 +11,7 @@ namespace osu.Game.Rulesets.Mods public override string Name => "Relax"; public override string ShortenedName => "RX"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax; + public override ModType Type => ModType.Automation; public override double ScoreMultiplier => 1; public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModNoFail), typeof(ModSuddenDeath) }; } diff --git a/osu.Game/Rulesets/Mods/ModType.cs b/osu.Game/Rulesets/Mods/ModType.cs index 913ba23701..9c962bbcd5 100644 --- a/osu.Game/Rulesets/Mods/ModType.cs +++ b/osu.Game/Rulesets/Mods/ModType.cs @@ -7,6 +7,8 @@ namespace osu.Game.Rulesets.Mods { DifficultyReduction, DifficultyIncrease, - Special + Conversion, + Automation, + Fun } } diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index cdc1248049..92e9a4831f 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -79,10 +79,18 @@ namespace osu.Game.Rulesets.UI backgroundColour = colours.Green; highlightedColour = colours.GreenLight; break; - case ModType.Special: + case ModType.Automation: backgroundColour = colours.Blue; highlightedColour = colours.BlueLight; break; + case ModType.Conversion: + backgroundColour = colours.Purple; + highlightedColour = colours.PurpleLight; + break; + case ModType.Fun: + backgroundColour = colours.Pink; + highlightedColour = colours.PinkLight; + break; } applyStyle(); @@ -92,10 +100,7 @@ namespace osu.Game.Rulesets.UI public bool Highlighted { - get - { - return highlighted; - } + get { return highlighted; } set { From 582bc58715ae163c53322c8983292541a9173353 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 Jul 2018 18:05:14 +0900 Subject: [PATCH 225/304] Remove unused colour propagation --- osu.Game/Overlays/Mods/ModSection.cs | 16 ---------------- .../Overlays/Mods/Sections/AutomationSection.cs | 8 -------- .../Overlays/Mods/Sections/ConversionSection.cs | 8 -------- .../Mods/Sections/DifficultyIncreaseSection.cs | 8 -------- .../Mods/Sections/DifficultyReductionSection.cs | 8 -------- osu.Game/Overlays/Mods/Sections/FunSection.cs | 8 -------- 6 files changed, 56 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 16ae070c1c..37bffaaf12 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -45,7 +44,6 @@ namespace osu.Game.Overlays.Mods return new ModButton(m) { - SelectedColour = selectedColour, SelectionChanged = Action, }; }).ToArray(); @@ -57,20 +55,6 @@ namespace osu.Game.Overlays.Mods private ModButton[] buttons = { }; - private Color4 selectedColour = Color4.White; - public Color4 SelectedColour - { - get => selectedColour; - set - { - if (value == selectedColour) return; - selectedColour = value; - - foreach (ModButton button in buttons) - button.SelectedColour = value; - } - } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { if (ToggleKeys != null) diff --git a/osu.Game/Overlays/Mods/Sections/AutomationSection.cs b/osu.Game/Overlays/Mods/Sections/AutomationSection.cs index 6d3b1fe7e6..2b509d539e 100644 --- a/osu.Game/Overlays/Mods/Sections/AutomationSection.cs +++ b/osu.Game/Overlays/Mods/Sections/AutomationSection.cs @@ -1,8 +1,6 @@ // 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.Game.Graphics; using osu.Game.Rulesets.Mods; using OpenTK.Input; @@ -13,12 +11,6 @@ namespace osu.Game.Overlays.Mods.Sections protected override Key[] ToggleKeys => new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }; public override ModType ModType => ModType.Automation; - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - SelectedColour = colours.BlueLight; - } - public AutomationSection() { Header = @"Automation"; diff --git a/osu.Game/Overlays/Mods/Sections/ConversionSection.cs b/osu.Game/Overlays/Mods/Sections/ConversionSection.cs index c757a59073..568f0ecfce 100644 --- a/osu.Game/Overlays/Mods/Sections/ConversionSection.cs +++ b/osu.Game/Overlays/Mods/Sections/ConversionSection.cs @@ -1,8 +1,6 @@ // 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.Game.Graphics; using osu.Game.Rulesets.Mods; using OpenTK.Input; @@ -13,12 +11,6 @@ namespace osu.Game.Overlays.Mods.Sections protected override Key[] ToggleKeys => null; public override ModType ModType => ModType.Conversion; - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - SelectedColour = colours.Purple; - } - public ConversionSection() { Header = @"Conversion"; diff --git a/osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs b/osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs index ed585cff22..5aced7ed5d 100644 --- a/osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs +++ b/osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs @@ -1,8 +1,6 @@ // 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.Game.Graphics; using osu.Game.Rulesets.Mods; using OpenTK.Input; @@ -13,12 +11,6 @@ namespace osu.Game.Overlays.Mods.Sections protected override Key[] ToggleKeys => new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }; public override ModType ModType => ModType.DifficultyIncrease; - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - SelectedColour = colours.YellowLight; - } - public DifficultyIncreaseSection() { Header = @"Difficulty Increase"; diff --git a/osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs b/osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs index 4aa8b1f16f..29fae2c70a 100644 --- a/osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs +++ b/osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs @@ -1,8 +1,6 @@ // 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.Game.Graphics; using osu.Game.Rulesets.Mods; using OpenTK.Input; @@ -13,12 +11,6 @@ namespace osu.Game.Overlays.Mods.Sections protected override Key[] ToggleKeys => new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }; public override ModType ModType => ModType.DifficultyReduction; - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - SelectedColour = colours.GreenLight; - } - public DifficultyReductionSection() { Header = @"Difficulty Reduction"; diff --git a/osu.Game/Overlays/Mods/Sections/FunSection.cs b/osu.Game/Overlays/Mods/Sections/FunSection.cs index ec6d469329..ef975d9d75 100644 --- a/osu.Game/Overlays/Mods/Sections/FunSection.cs +++ b/osu.Game/Overlays/Mods/Sections/FunSection.cs @@ -1,8 +1,6 @@ // 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.Game.Graphics; using osu.Game.Rulesets.Mods; using OpenTK.Input; @@ -13,12 +11,6 @@ namespace osu.Game.Overlays.Mods.Sections protected override Key[] ToggleKeys => null; public override ModType ModType => ModType.Fun; - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - SelectedColour = colours.PinkLight; - } - public FunSection() { Header = @"Fun"; From 47533f83c3ea27a832ddb0fbd4a6cc37b5863d28 Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Tue, 31 Jul 2018 17:56:54 +0930 Subject: [PATCH 226/304] Update TabControl subclasses to use AddInternal --- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 2 +- osu.Game/Overlays/UserProfileOverlay.cs | 2 +- osu.Game/Screens/Edit/Menus/ScreenSelectionTabControl.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 1b91d0cad3..e2a0b88b2a 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -37,7 +37,7 @@ namespace osu.Game.Graphics.UserInterface { TabContainer.Spacing = new Vector2(10f, 0f); - Add(strip = new Box + AddInternal(strip = new Box { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 745f2f3def..11b68b0e09 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -195,7 +195,7 @@ namespace osu.Game.Overlays TabContainer.AutoSizeAxes |= Axes.X; TabContainer.Anchor |= Anchor.x1; TabContainer.Origin |= Anchor.x1; - Add(bottom = new Box + AddInternal(bottom = new Box { RelativeSizeAxes = Axes.X, Height = 1, diff --git a/osu.Game/Screens/Edit/Menus/ScreenSelectionTabControl.cs b/osu.Game/Screens/Edit/Menus/ScreenSelectionTabControl.cs index 1471a37a29..f58e5b39eb 100644 --- a/osu.Game/Screens/Edit/Menus/ScreenSelectionTabControl.cs +++ b/osu.Game/Screens/Edit/Menus/ScreenSelectionTabControl.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.Edit.Menus TabContainer.AutoSizeAxes = Axes.X; TabContainer.Padding = new MarginPadding(); - Add(new Box + AddInternal(new Box { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, From 4fdca2b1982fc4066ccf208af0f325446b4c9035 Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Tue, 31 Jul 2018 21:21:26 +0930 Subject: [PATCH 227/304] 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 85e9e7e181..aa74641d28 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 4f1736ceb2e6018aebab5e6169de453be5c8806c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Aug 2018 02:58:39 +0900 Subject: [PATCH 228/304] Make squirrel work again --- osu.Desktop/OsuGameDesktop.cs | 10 +++++----- osu.Desktop/Updater/SquirrelUpdateManager.cs | 2 -- osu.Desktop/osu.Desktop.csproj | 8 +++----- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index a4270f22b4..79ac24a1da 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -13,6 +13,7 @@ using osu.Game; using OpenTK.Input; using Microsoft.Win32; using osu.Desktop.Updater; +using osu.Framework; using osu.Framework.Platform.Windows; namespace osu.Desktop @@ -51,11 +52,10 @@ namespace osu.Desktop v.State = Visibility.Visible; }); -#if NET_FRAMEWORK - Add(new SquirrelUpdateManager()); -#else - Add(new SimpleUpdateManager()); -#endif + if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows) + Add(new SquirrelUpdateManager()); + else + Add(new SimpleUpdateManager()); } } diff --git a/osu.Desktop/Updater/SquirrelUpdateManager.cs b/osu.Desktop/Updater/SquirrelUpdateManager.cs index 81da26cff2..1f8bff74f4 100644 --- a/osu.Desktop/Updater/SquirrelUpdateManager.cs +++ b/osu.Desktop/Updater/SquirrelUpdateManager.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 -#if NET_FRAMEWORK using System; using System.Threading.Tasks; using osu.Framework.Allocation; @@ -162,4 +161,3 @@ namespace osu.Desktop.Updater } } } -#endif diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 1d9928134d..880ef3b2a9 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -13,9 +13,6 @@ 0.0.0 0.0.0 - - $(DefineConstants);NET_FRAMEWORK - osu.Desktop.Program @@ -29,11 +26,12 @@ + + - - \ No newline at end of file + From 854beaab5f590f3a3e6fc0bd6f788c8fc2ed792e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Aug 2018 02:58:49 +0900 Subject: [PATCH 229/304] Remove only remaining .NET desktop code --- osu.Desktop/Program.cs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 7e6a07c89f..cc08e08653 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -8,10 +8,6 @@ using osu.Framework; using osu.Framework.Platform; using osu.Game.IPC; -#if NET_FRAMEWORK -using System.Runtime; -#endif - namespace osu.Desktop { public static class Program @@ -19,8 +15,6 @@ namespace osu.Desktop [STAThread] public static int Main(string[] args) { - useMultiCoreJit(); - // Back up the cwd before DesktopGameHost changes it var cwd = Environment.CurrentDirectory; @@ -51,14 +45,5 @@ namespace osu.Desktop return 0; } } - - private static void useMultiCoreJit() - { -#if NET_FRAMEWORK - var directory = Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Profiles")); - ProfileOptimization.SetProfileRoot(directory.FullName); - ProfileOptimization.StartProfile("Startup.Profile"); -#endif - } } } From 3d136bf207eff2d6ee0d39881eb13cb04beaf6e5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Aug 2018 03:37:59 +0900 Subject: [PATCH 230/304] Remove unused nuspec --- osu.Game/osu.nuspec | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 osu.Game/osu.nuspec diff --git a/osu.Game/osu.nuspec b/osu.Game/osu.nuspec deleted file mode 100644 index bb7d382cee..0000000000 --- a/osu.Game/osu.nuspec +++ /dev/null @@ -1,26 +0,0 @@ - - - - osulazer - 0.0.0 - osulazer - ppy Pty Ltd - Dean Herbert - https://osu.ppy.sh/ - https://puu.sh/tYyXZ/9a01a5d1b0.ico - false - click the circles. to the beat. - click the circles. - testing - Copyright ppy Pty Ltd 2007-2018 - en-AU - - - - - - - - - - From 139f6d8c4fadb14a9e00bb2d16811c57a1462f98 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Aug 2018 12:30:09 +0900 Subject: [PATCH 231/304] Fix incorrect nuspec title --- osu.Desktop/osu.nuspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/osu.nuspec b/osu.Desktop/osu.nuspec index 316a5443ef..cdd232a9b2 100644 --- a/osu.Desktop/osu.nuspec +++ b/osu.Desktop/osu.nuspec @@ -3,7 +3,7 @@ osulazer 0.0.0 - osulazer + osu!lazer ppy Pty Ltd Dean Herbert https://osu.ppy.sh/ From ecc6d55380a89334702082b8579ebb40334d7bef Mon Sep 17 00:00:00 2001 From: ekrctb Date: Wed, 1 Aug 2018 16:20:29 +0900 Subject: [PATCH 232/304] Fix player loader not gets ready when multiple mouse button is down --- osu.Game/Screens/Play/PlayerLoader.cs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 4abc0dfcd9..97a728ffb7 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -6,8 +6,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Framework.Threading; @@ -123,23 +121,9 @@ namespace osu.Game.Screens.Play logo.Delay(resuming ? 0 : 500).MoveToOffset(new Vector2(0, -0.24f), 500, Easing.InOutExpo); } - private bool weHandledMouseDown; - - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) - { - weHandledMouseDown = true; - return base.OnMouseDown(state, args); - } - - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) - { - weHandledMouseDown = false; - return base.OnMouseUp(state, args); - } - private ScheduledDelegate pushDebounce; - private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && (!GetContainingInputManager().CurrentState.Mouse.HasAnyButtonPressed || weHandledMouseDown); + private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && GetContainingInputManager()?.DraggedDrawable == null; private void pushWhenLoaded() { From 4224d35a7570c18f16aac0cbb0b7ce5dbfcac9b2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Aug 2018 16:56:36 +0900 Subject: [PATCH 233/304] Use forked squirrel Allows for updating SharpCompress, too. --- osu.Desktop/osu.Desktop.csproj | 2 +- osu.Game/osu.Game.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 880ef3b2a9..87c518b492 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -27,7 +27,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index aa74641d28..157b4f71c2 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -19,7 +19,7 @@ - + From 6ce32bd431e91bda590536cb37fd361e0f8f634a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Aug 2018 16:56:46 +0900 Subject: [PATCH 234/304] Update remaining nuget deps --- osu.Desktop/osu.Desktop.csproj | 2 +- .../osu.Game.Rulesets.Catch.Tests.csproj | 2 +- .../osu.Game.Rulesets.Mania.Tests.csproj | 2 +- osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj | 2 +- .../osu.Game.Rulesets.Taiko.Tests.csproj | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 2 +- osu.Game/osu.Game.csproj | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 87c518b492..6ee9c3155e 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -27,7 +27,7 @@ - + diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj index 9bef8f258c..51343d9e91 100644 --- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj +++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj @@ -2,7 +2,7 @@ - + diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj index 61057a64a1..3165f69a6b 100644 --- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj +++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj @@ -2,7 +2,7 @@ - + diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj index 9e10a556a4..247d5e18c1 100644 --- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj +++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj @@ -2,7 +2,7 @@ - + diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj index 0e29da1549..08a0579561 100644 --- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj +++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj @@ -2,7 +2,7 @@ - + diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 478a06ed30..d638af0c38 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -2,7 +2,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 157b4f71c2..89e80bd06b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 41512667a8d8b5088a65f702874ad709b04d432a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 1 Aug 2018 19:51:24 +0900 Subject: [PATCH 235/304] Require all judgements to be present for map completion --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 9e8ea0f7c2..fa8c11df7f 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -247,6 +247,8 @@ namespace osu.Game.Rulesets.Scoring judgement.ComboAtJudgement = Combo; judgement.HighestComboAtJudgement = HighestCombo; + JudgedHits++; + if (judgement.AffectsCombo) { switch (judgement.Result) @@ -260,8 +262,6 @@ namespace osu.Game.Rulesets.Scoring Combo.Value++; break; } - - JudgedHits++; } if (judgement.IsBonus) @@ -285,8 +285,7 @@ namespace osu.Game.Rulesets.Scoring Combo.Value = judgement.ComboAtJudgement; HighestCombo.Value = judgement.HighestComboAtJudgement; - if (judgement.AffectsCombo) - JudgedHits--; + JudgedHits--; if (judgement.IsBonus) { From d51d0e85471722fa95b0e5d458cabfe09ada996f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 1 Aug 2018 21:04:03 +0900 Subject: [PATCH 236/304] Initial structure for new hitobject judgement system --- osu.Game/Rulesets/Judgements/Judgement.cs | 12 ++--- .../Objects/Drawables/DrawableHitObject.cs | 50 +++++++++++-------- osu.Game/Rulesets/Objects/HitObject.cs | 10 ++++ 3 files changed, 44 insertions(+), 28 deletions(-) diff --git a/osu.Game/Rulesets/Judgements/Judgement.cs b/osu.Game/Rulesets/Judgements/Judgement.cs index 129dd07c3e..63378e57cc 100644 --- a/osu.Game/Rulesets/Judgements/Judgement.cs +++ b/osu.Game/Rulesets/Judgements/Judgement.cs @@ -28,19 +28,19 @@ namespace osu.Game.Rulesets.Judgements /// public int HighestComboAtJudgement; + /// + /// Whether this has a result. + /// + public bool HasResult => Result > HitResult.None; + /// /// Whether a successful hit occurred. /// public bool IsHit => Result > HitResult.Miss; - /// - /// Whether this judgement is the final judgement for the hit object. - /// - public bool Final = true; - /// /// The offset from a perfect hit at which this judgement occurred. - /// Populated when added via . + /// Populated when added via . /// public double TimeOffset { get; set; } diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index a22aaa784f..b767834e5d 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -38,9 +38,6 @@ namespace osu.Game.Rulesets.Objects.Drawables public event Action OnJudgement; public event Action OnJudgementRemoved; - public IReadOnlyList Judgements => judgements; - private readonly List judgements = new List(); - /// /// Whether a visible judgement should be displayed when this representation is hit. /// @@ -49,20 +46,20 @@ namespace osu.Game.Rulesets.Objects.Drawables /// /// Whether this and all of its nested s have been hit. /// - public bool IsHit => Judgements.Any(j => j.Final && j.IsHit) && NestedHitObjects.All(n => n.IsHit); + public bool IsHit => HitObject.Judgements.All(j => j.IsHit) && NestedHitObjects.All(n => n.IsHit); /// /// Whether this and all of its nested s have been judged. /// - public bool AllJudged => (!ProvidesJudgement || judgementFinalized) && NestedHitObjects.All(h => h.AllJudged); + public bool AllJudged => Judged && NestedHitObjects.All(h => h.AllJudged); /// - /// Whether this can be judged. + /// Whether this has been judged. + /// Note: This does NOT include nested hitobjects. /// - protected virtual bool ProvidesJudgement => true; + public bool Judged => HitObject.Judgements.All(h => h.HasResult); private bool judgementOccurred; - private bool judgementFinalized => judgements.LastOrDefault()?.Final == true; public bool Interactive = true; public override bool HandleKeyboardInput => Interactive; @@ -128,23 +125,31 @@ namespace osu.Game.Rulesets.Objects.Drawables /// public void PlaySamples() => Samples?.Play(); + private double lastUpdateTime; + protected override void Update() { base.Update(); - var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; - - while (judgements.Count > 0) + if (lastUpdateTime > Time.Current) { - var lastJudgement = judgements[judgements.Count - 1]; - if (lastJudgement.TimeOffset + endTime <= Time.Current) - break; + var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; - judgements.RemoveAt(judgements.Count - 1); - State.Value = ArmedState.Idle; + for (int i = HitObject.Judgements.Count - 1; i >= 0; i--) + { + var judgement = HitObject.Judgements[i]; - OnJudgementRemoved?.Invoke(this, lastJudgement); + if (judgement.TimeOffset + endTime <= Time.Current) + break; + + judgement.Result = HitResult.None; + State.Value = ArmedState.Idle; + + OnJudgementRemoved?.Invoke(this, judgement); + } } + + lastUpdateTime = Time.Current; } protected override void UpdateAfterChildren() @@ -167,16 +172,17 @@ namespace osu.Game.Rulesets.Objects.Drawables /// Notifies that a new judgement has occurred for this . /// /// The . - protected void AddJudgement(Judgement judgement) + protected void ApplyJudgement(T judgement, Action application) + where T : Judgement { judgementOccurred = true; + application?.Invoke(judgement); + // Ensure that the judgement is given a valid time offset, because this may not get set by the caller var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; judgement.TimeOffset = Time.Current - endTime; - judgements.Add(judgement); - switch (judgement.Result) { case HitResult.None: @@ -207,7 +213,7 @@ namespace osu.Game.Rulesets.Objects.Drawables foreach (var d in NestedHitObjects) judgementOccurred |= d.UpdateJudgement(userTriggered); - if (!ProvidesJudgement || judgementFinalized || judgementOccurred) + if (judgementOccurred || Judged) return judgementOccurred; var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; @@ -218,7 +224,7 @@ namespace osu.Game.Rulesets.Objects.Drawables /// /// Checks if any judgements have occurred for this . This method must construct - /// all s and notify of them through . + /// all s and notify of them through . /// /// Whether the user triggered this check. /// The offset from the end time at which this check occurred. A > 0 diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index 15c24e2975..0e029a8657 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -3,12 +3,14 @@ using System; using System.Collections.Generic; +using System.Linq; using Newtonsoft.Json; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Lists; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Objects @@ -62,6 +64,9 @@ namespace osu.Game.Rulesets.Objects [JsonIgnore] public IReadOnlyList NestedHitObjects => nestedHitObjects.Value; + private readonly List judgements = new List(); + public IReadOnlyList Judgements => judgements; + /// /// Applies default values to this HitObject. /// @@ -71,6 +76,9 @@ namespace osu.Game.Rulesets.Objects { ApplyDefaultsToSelf(controlPointInfo, difficulty); + judgements.Clear(); + judgements.AddRange(CreateJudgements()); + if (nestedHitObjects.IsValueCreated) nestedHitObjects.Value.Clear(); @@ -103,6 +111,8 @@ namespace osu.Game.Rulesets.Objects { } + protected virtual IEnumerable CreateJudgements() => Enumerable.Empty(); + protected void AddNested(HitObject hitObject) => nestedHitObjects.Value.Add(hitObject); /// From 21a19dc5522189f05a7afbfdfee2ab2eaea951b0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Aug 2018 22:07:39 +0900 Subject: [PATCH 237/304] Remove remaining references to net471 --- README.md | 2 +- appveyor_deploy.yml | 6 +-- .../.vscode/launch.json | 36 ++------------- .../.vscode/tasks.json | 46 ++----------------- .../.vscode/launch.json | 36 ++------------- .../.vscode/tasks.json | 46 ++----------------- .../.vscode/launch.json | 36 ++------------- .../.vscode/tasks.json | 46 ++----------------- .../.vscode/launch.json | 36 ++------------- .../.vscode/tasks.json | 46 ++----------------- 10 files changed, 31 insertions(+), 305 deletions(-) diff --git a/README.md b/README.md index a1932b0fdf..a1f478e39a 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Clone the repository including submodules Build and run - Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included) -- From command line using `dotnet run --project osu.Desktop --framework netcoreapp2.1` +- From command line using `dotnet run --project osu.Desktop` If you run into issues building you may need to restore nuget packages (commonly via `dotnet restore`). Visual Studio Code users must run `Restore` task from debug tab before attempt to build. diff --git a/appveyor_deploy.yml b/appveyor_deploy.yml index 0247714cdf..abfe1e4368 100644 --- a/appveyor_deploy.yml +++ b/appveyor_deploy.yml @@ -16,11 +16,9 @@ build_script: - cd osu-deploy - nuget restore -verbosity quiet - msbuild osu.Desktop.Deploy.csproj - - cmd: ..\appveyor-tools\secure-file -decrypt ..\fdc6f19b04.enc -secret %decode_secret% -out bin\Debug\net471\osu.Desktop.Deploy.exe.config - - cd bin\Debug\net471\ - - osu.Desktop.Deploy.exe %code_signing_password% %APPVEYOR_REPO_TAG_NAME% + - cmd: ..\appveyor-tools\secure-file -decrypt ..\fdc6f19b04.enc -secret %decode_secret% -out bin\Debug\netcoreapp2.1\osu.Desktop.Deploy.dll.config + - dotnet bin/Debug/netcoreapp2.1/osu.Desktop.Deploy.dll %code_signing_password% %APPVEYOR_REPO_TAG_NAME% environment: - TargetFramework: net471 decode_secret: secure: i67IC2xj6DjjxmA6Oj2jing3+MwzLkq6CbGsjfZ7rdY= code_signing_password: diff --git a/osu.Game.Rulesets.Catch.Tests/.vscode/launch.json b/osu.Game.Rulesets.Catch.Tests/.vscode/launch.json index 2a82d65014..da9344b6a2 100644 --- a/osu.Game.Rulesets.Catch.Tests/.vscode/launch.json +++ b/osu.Game.Rulesets.Catch.Tests/.vscode/launch.json @@ -2,35 +2,7 @@ "version": "0.2.0", "configurations": [ { - "name": "VisualTests (Debug, net471)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/bin/Debug/net471/osu.Game.Rulesets.Catch.Tests.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Debug, msbuild)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, - { - "name": "VisualTests (Release, net471)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/bin/Release/net471/osu.Game.Rulesets.Catch.Tests.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release, msbuild)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, - { - "name": "VisualTests (Debug, netcoreapp2.1)", + "name": "VisualTests (Debug)", "type": "coreclr", "request": "launch", "program": "dotnet", @@ -38,12 +10,12 @@ "${workspaceRoot}/bin/Debug/netcoreapp2.1/osu.Game.Rulesets.Catch.Tests.dll" ], "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Debug, dotnet)", + "preLaunchTask": "Build (Debug)", "env": {}, "console": "internalConsole" }, { - "name": "VisualTests (Release, netcoreapp2.1)", + "name": "VisualTests (Release)", "type": "coreclr", "request": "launch", "program": "dotnet", @@ -51,7 +23,7 @@ "${workspaceRoot}/bin/Release/netcoreapp2.1/osu.Game.Rulesets.Catch.Tests.dll" ], "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release, dotnet)", + "preLaunchTask": "Build (Release)", "env": {}, "console": "internalConsole" } diff --git a/osu.Game.Rulesets.Catch.Tests/.vscode/tasks.json b/osu.Game.Rulesets.Catch.Tests/.vscode/tasks.json index 6c6d562512..18a6f8ca70 100644 --- a/osu.Game.Rulesets.Catch.Tests/.vscode/tasks.json +++ b/osu.Game.Rulesets.Catch.Tests/.vscode/tasks.json @@ -4,43 +4,13 @@ "version": "2.0.0", "tasks": [ { - "label": "Build (Debug, msbuild)", - "type": "shell", - "command": "msbuild", - "args": [ - "osu.Game.Rulesets.Catch.Tests.csproj", - "/p:TargetFramework=net471", - "/p:GenerateFullPaths=true", - "/m", - "/verbosity:m" - ], - "group": "build", - "problemMatcher": "$msCompile" - }, - { - "label": "Build (Release, msbuild)", - "type": "shell", - "command": "msbuild", - "args": [ - "osu.Game.Rulesets.Catch.Tests.csproj", - "/p:Configuration=Release", - "/p:TargetFramework=net471", - "/p:GenerateFullPaths=true", - "/m", - "/verbosity:m" - ], - "group": "build", - "problemMatcher": "$msCompile" - }, - { - "label": "Build (Debug, dotnet)", + "label": "Build (Debug)", "type": "shell", "command": "dotnet", "args": [ "build", "--no-restore", "osu.Game.Rulesets.Catch.Tests.csproj", - "/p:TargetFramework=netcoreapp2.1", "/p:GenerateFullPaths=true", "/m", "/verbosity:m" @@ -49,14 +19,13 @@ "problemMatcher": "$msCompile" }, { - "label": "Build (Release, dotnet)", + "label": "Build (Release)", "type": "shell", "command": "dotnet", "args": [ "build", "--no-restore", "osu.Game.Rulesets.Catch.Tests.csproj", - "/p:TargetFramework=netcoreapp2.1", "/p:Configuration=Release", "/p:GenerateFullPaths=true", "/m", @@ -66,16 +35,7 @@ "problemMatcher": "$msCompile" }, { - "label": "Restore (net471)", - "type": "shell", - "command": "nuget", - "args": [ - "restore" - ], - "problemMatcher": [] - }, - { - "label": "Restore (netcoreapp2.1)", + "label": "Restore", "type": "shell", "command": "dotnet", "args": [ diff --git a/osu.Game.Rulesets.Mania.Tests/.vscode/launch.json b/osu.Game.Rulesets.Mania.Tests/.vscode/launch.json index bc41d4ccf9..c781b0e64e 100644 --- a/osu.Game.Rulesets.Mania.Tests/.vscode/launch.json +++ b/osu.Game.Rulesets.Mania.Tests/.vscode/launch.json @@ -2,35 +2,7 @@ "version": "0.2.0", "configurations": [ { - "name": "VisualTests (Debug, net471)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/bin/Debug/net471/osu.Game.Rulesets.Mania.Tests.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Debug, msbuild)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, - { - "name": "VisualTests (Release, net471)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/bin/Release/net471/osu.Game.Rulesets.Mania.Tests.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release, msbuild)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, - { - "name": "VisualTests (Debug, netcoreapp2.1)", + "name": "VisualTests (Debug)", "type": "coreclr", "request": "launch", "program": "dotnet", @@ -38,12 +10,12 @@ "${workspaceRoot}/bin/Debug/netcoreapp2.1/osu.Game.Rulesets.Mania.Tests.dll" ], "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Debug, dotnet)", + "preLaunchTask": "Build (Debug)", "env": {}, "console": "internalConsole" }, { - "name": "VisualTests (Release, netcoreapp2.1)", + "name": "VisualTests (Release)", "type": "coreclr", "request": "launch", "program": "dotnet", @@ -51,7 +23,7 @@ "${workspaceRoot}/bin/Release/netcoreapp2.1/osu.Game.Rulesets.Mania.Tests.dll" ], "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release, dotnet)", + "preLaunchTask": "Build (Release)", "env": {}, "console": "internalConsole" } diff --git a/osu.Game.Rulesets.Mania.Tests/.vscode/tasks.json b/osu.Game.Rulesets.Mania.Tests/.vscode/tasks.json index 7fc2f7b2ef..608c4340ac 100644 --- a/osu.Game.Rulesets.Mania.Tests/.vscode/tasks.json +++ b/osu.Game.Rulesets.Mania.Tests/.vscode/tasks.json @@ -4,43 +4,13 @@ "version": "2.0.0", "tasks": [ { - "label": "Build (Debug, msbuild)", - "type": "shell", - "command": "msbuild", - "args": [ - "osu.Game.Rulesets.Mania.Tests.csproj", - "/p:TargetFramework=net471", - "/p:GenerateFullPaths=true", - "/m", - "/verbosity:m" - ], - "group": "build", - "problemMatcher": "$msCompile" - }, - { - "label": "Build (Release, msbuild)", - "type": "shell", - "command": "msbuild", - "args": [ - "osu.Game.Rulesets.Mania.Tests.csproj", - "/p:Configuration=Release", - "/p:TargetFramework=net471", - "/p:GenerateFullPaths=true", - "/m", - "/verbosity:m" - ], - "group": "build", - "problemMatcher": "$msCompile" - }, - { - "label": "Build (Debug, dotnet)", + "label": "Build (Debug)", "type": "shell", "command": "dotnet", "args": [ "build", "--no-restore", "osu.Game.Rulesets.Mania.Tests.csproj", - "/p:TargetFramework=netcoreapp2.1", "/p:GenerateFullPaths=true", "/m", "/verbosity:m" @@ -49,14 +19,13 @@ "problemMatcher": "$msCompile" }, { - "label": "Build (Release, dotnet)", + "label": "Build (Release)", "type": "shell", "command": "dotnet", "args": [ "build", "--no-restore", "osu.Game.Rulesets.Mania.Tests.csproj", - "/p:TargetFramework=netcoreapp2.1", "/p:Configuration=Release", "/p:GenerateFullPaths=true", "/m", @@ -66,16 +35,7 @@ "problemMatcher": "$msCompile" }, { - "label": "Restore (net471)", - "type": "shell", - "command": "nuget", - "args": [ - "restore" - ], - "problemMatcher": [] - }, - { - "label": "Restore (netcoreapp2.1)", + "label": "Restore", "type": "shell", "command": "dotnet", "args": [ diff --git a/osu.Game.Rulesets.Osu.Tests/.vscode/launch.json b/osu.Game.Rulesets.Osu.Tests/.vscode/launch.json index 13aba025fd..fe3ecbec47 100644 --- a/osu.Game.Rulesets.Osu.Tests/.vscode/launch.json +++ b/osu.Game.Rulesets.Osu.Tests/.vscode/launch.json @@ -2,35 +2,7 @@ "version": "0.2.0", "configurations": [ { - "name": "VisualTests (Debug, net471)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/bin/Debug/net471/osu.Game.Rulesets.Osu.Tests.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Debug, msbuild)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, - { - "name": "VisualTests (Release, net471)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/bin/Release/net471/osu.Game.Rulesets.Osu.Tests.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release, msbuild)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, - { - "name": "VisualTests (Debug, netcoreapp2.1)", + "name": "VisualTests (Debug)", "type": "coreclr", "request": "launch", "program": "dotnet", @@ -38,12 +10,12 @@ "${workspaceRoot}/bin/Debug/netcoreapp2.1/osu.Game.Rulesets.Osu.Tests.dll" ], "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Debug, dotnet)", + "preLaunchTask": "Build (Debug)", "env": {}, "console": "internalConsole" }, { - "name": "VisualTests (Release, netcoreapp2.1)", + "name": "VisualTests (Release)", "type": "coreclr", "request": "launch", "program": "dotnet", @@ -51,7 +23,7 @@ "${workspaceRoot}/bin/Release/netcoreapp2.1/osu.Game.Rulesets.Osu.Tests.dll" ], "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release, dotnet)", + "preLaunchTask": "Build (Release)", "env": {}, "console": "internalConsole" } diff --git a/osu.Game.Rulesets.Osu.Tests/.vscode/tasks.json b/osu.Game.Rulesets.Osu.Tests/.vscode/tasks.json index 62cf51382f..ed2a015e11 100644 --- a/osu.Game.Rulesets.Osu.Tests/.vscode/tasks.json +++ b/osu.Game.Rulesets.Osu.Tests/.vscode/tasks.json @@ -4,43 +4,13 @@ "version": "2.0.0", "tasks": [ { - "label": "Build (Debug, msbuild)", - "type": "shell", - "command": "msbuild", - "args": [ - "osu.Game.Rulesets.Osu.Tests.csproj", - "/p:TargetFramework=net471", - "/p:GenerateFullPaths=true", - "/m", - "/verbosity:m" - ], - "group": "build", - "problemMatcher": "$msCompile" - }, - { - "label": "Build (Release, msbuild)", - "type": "shell", - "command": "msbuild", - "args": [ - "osu.Game.Rulesets.Osu.Tests.csproj", - "/p:Configuration=Release", - "/p:TargetFramework=net471", - "/p:GenerateFullPaths=true", - "/m", - "/verbosity:m" - ], - "group": "build", - "problemMatcher": "$msCompile" - }, - { - "label": "Build (Debug, dotnet)", + "label": "Build (Debug)", "type": "shell", "command": "dotnet", "args": [ "build", "--no-restore", "osu.Game.Rulesets.Osu.Tests.csproj", - "/p:TargetFramework=netcoreapp2.1", "/p:GenerateFullPaths=true", "/m", "/verbosity:m" @@ -49,14 +19,13 @@ "problemMatcher": "$msCompile" }, { - "label": "Build (Release, dotnet)", + "label": "Build (Release)", "type": "shell", "command": "dotnet", "args": [ "build", "--no-restore", "osu.Game.Rulesets.Osu.Tests.csproj", - "/p:TargetFramework=netcoreapp2.1", "/p:Configuration=Release", "/p:GenerateFullPaths=true", "/m", @@ -66,16 +35,7 @@ "problemMatcher": "$msCompile" }, { - "label": "Restore (net471)", - "type": "shell", - "command": "nuget", - "args": [ - "restore" - ], - "problemMatcher": [] - }, - { - "label": "Restore (netcoreapp2.1)", + "label": "Restore", "type": "shell", "command": "dotnet", "args": [ diff --git a/osu.Game.Rulesets.Taiko.Tests/.vscode/launch.json b/osu.Game.Rulesets.Taiko.Tests/.vscode/launch.json index df49e177dc..de7bf77070 100644 --- a/osu.Game.Rulesets.Taiko.Tests/.vscode/launch.json +++ b/osu.Game.Rulesets.Taiko.Tests/.vscode/launch.json @@ -2,35 +2,7 @@ "version": "0.2.0", "configurations": [ { - "name": "VisualTests (Debug, net471)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/bin/Debug/net471/osu.Game.Rulesets.Taiko.Tests.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Debug, msbuild)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, - { - "name": "VisualTests (Release, net471)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/bin/Release/net471/osu.Game.Rulesets.Taiko.Tests.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release, msbuild)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, - { - "name": "VisualTests (Debug, netcoreapp2.1)", + "name": "VisualTests (Debug)", "type": "coreclr", "request": "launch", "program": "dotnet", @@ -38,12 +10,12 @@ "${workspaceRoot}/bin/Debug/netcoreapp2.1/osu.Game.Rulesets.Taiko.Tests.dll" ], "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Debug, dotnet)", + "preLaunchTask": "Build (Debug)", "env": {}, "console": "internalConsole" }, { - "name": "VisualTests (Release, netcoreapp2.1)", + "name": "VisualTests (Release)", "type": "coreclr", "request": "launch", "program": "dotnet", @@ -51,7 +23,7 @@ "${workspaceRoot}/bin/Release/netcoreapp2.1/osu.Game.Rulesets.Taiko.Tests.dll" ], "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release, dotnet)", + "preLaunchTask": "Build (Release)", "env": {}, "console": "internalConsole" } diff --git a/osu.Game.Rulesets.Taiko.Tests/.vscode/tasks.json b/osu.Game.Rulesets.Taiko.Tests/.vscode/tasks.json index 7c8beed00f..9b91f2c9b9 100644 --- a/osu.Game.Rulesets.Taiko.Tests/.vscode/tasks.json +++ b/osu.Game.Rulesets.Taiko.Tests/.vscode/tasks.json @@ -4,43 +4,13 @@ "version": "2.0.0", "tasks": [ { - "label": "Build (Debug, msbuild)", - "type": "shell", - "command": "msbuild", - "args": [ - "osu.Game.Rulesets.Taiko.Tests.csproj", - "/p:TargetFramework=net471", - "/p:GenerateFullPaths=true", - "/m", - "/verbosity:m" - ], - "group": "build", - "problemMatcher": "$msCompile" - }, - { - "label": "Build (Release, msbuild)", - "type": "shell", - "command": "msbuild", - "args": [ - "osu.Game.Rulesets.Taiko.Tests.csproj", - "/p:Configuration=Release", - "/p:TargetFramework=net471", - "/p:GenerateFullPaths=true", - "/m", - "/verbosity:m" - ], - "group": "build", - "problemMatcher": "$msCompile" - }, - { - "label": "Build (Debug, dotnet)", + "label": "Build (Debug)", "type": "shell", "command": "dotnet", "args": [ "build", "--no-restore", "osu.Game.Rulesets.Taiko.Tests.csproj", - "/p:TargetFramework=netcoreapp2.1", "/p:GenerateFullPaths=true", "/m", "/verbosity:m" @@ -49,14 +19,13 @@ "problemMatcher": "$msCompile" }, { - "label": "Build (Release, dotnet)", + "label": "Build (Release)", "type": "shell", "command": "dotnet", "args": [ "build", "--no-restore", "osu.Game.Rulesets.Taiko.Tests.csproj", - "/p:TargetFramework=netcoreapp2.1", "/p:Configuration=Release", "/p:GenerateFullPaths=true", "/m", @@ -66,16 +35,7 @@ "problemMatcher": "$msCompile" }, { - "label": "Restore (net471)", - "type": "shell", - "command": "nuget", - "args": [ - "restore" - ], - "problemMatcher": [] - }, - { - "label": "Restore (netcoreapp2.1)", + "label": "Restore", "type": "shell", "command": "dotnet", "args": [ From d454dbfdc2106cd79c22a71e19e7cacf4cba370e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Aug 2018 22:34:45 +0900 Subject: [PATCH 238/304] Fix artifact collection --- appveyor_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor_deploy.yml b/appveyor_deploy.yml index abfe1e4368..6d8d95e773 100644 --- a/appveyor_deploy.yml +++ b/appveyor_deploy.yml @@ -24,7 +24,7 @@ environment: code_signing_password: secure: 34tLNqvjmmZEi97MLKfrnQ== artifacts: - - path: 'Releases\*' + - path: 'osu-deploy/releases/*' deploy: - provider: Environment name: github \ No newline at end of file From 70ee7e4afdea9a442e4f197577f2de82f1a46af4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Aug 2018 07:59:48 +0900 Subject: [PATCH 239/304] Scroll chat to end of buffer when posting a new message --- osu.Game/Overlays/Chat/DrawableChannel.cs | 6 +++--- osu.Game/Overlays/ChatOverlay.cs | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index bcc8879902..acc145af68 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Chat protected override void LoadComplete() { base.LoadComplete(); - scrollToEnd(); + ScrollToEnd(); } protected override void Dispose(bool isDisposing) @@ -86,7 +86,7 @@ namespace osu.Game.Overlays.Chat if (!IsLoaded) return; if (scroll.IsScrolledToEnd(10) || !flow.Children.Any()) - scrollToEnd(); + ScrollToEnd(); var staleMessages = flow.Children.Where(c => c.LifetimeEnd == double.MaxValue).ToArray(); int count = staleMessages.Length - Channel.MAX_HISTORY; @@ -118,7 +118,7 @@ namespace osu.Game.Overlays.Chat flow.Children.FirstOrDefault(c => c.Message == removed)?.FadeColour(Color4.Red, 400).FadeOut(600).Expire(); } - private void scrollToEnd() => ScheduleAfterChildren(() => scroll.ScrollToEnd()); + public void ScrollToEnd() => ScheduleAfterChildren(() => scroll.ScrollToEnd()); private class ChatLineContainer : FillFlowContainer { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 8e20d76914..f86c5204bb 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -475,6 +475,8 @@ namespace osu.Game.Overlays if (target == null) return; + currentChannelContainer.Child.ScrollToEnd(); + if (!api.IsLoggedIn) { target.AddNewMessages(new ErrorMessage("Please sign in to participate in chat!")); From 462f1033c0e10cabd675d047522f804212f7f356 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 1 Aug 2018 21:46:22 +0900 Subject: [PATCH 240/304] Migrate Rulesets.Osu to the new judgement system --- .../TestCaseHitCircle.cs | 8 +------ .../Objects/Drawables/DrawableHitCircle.cs | 9 +++----- .../Objects/Drawables/DrawableOsuHitObject.cs | 2 +- .../Objects/Drawables/DrawableRepeatPoint.cs | 3 +-- .../Objects/Drawables/DrawableSlider.cs | 21 +++++++++++-------- .../Objects/Drawables/DrawableSliderTail.cs | 5 ++--- .../Objects/Drawables/DrawableSliderTick.cs | 3 +-- .../Objects/Drawables/DrawableSpinner.cs | 16 +++++++------- osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 9 ++++++++ osu.Game.Rulesets.Osu/Objects/Slider.cs | 4 ++-- .../Objects/SliderTailCircle.cs | 17 +++++++++++++++ 11 files changed, 58 insertions(+), 39 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs index 7af7140fd8..eea5aa9a52 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs @@ -5,12 +5,10 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; using OpenTK; -using osu.Game.Rulesets.Osu.Judgements; using System.Collections.Generic; using System; using osu.Game.Rulesets.Mods; @@ -101,11 +99,7 @@ namespace osu.Game.Rulesets.Osu.Tests if (auto && !userTriggered && timeOffset > 0) { // force success - AddJudgement(new OsuJudgement - { - Result = HitResult.Great - }); - State.Value = ArmedState.Hit; + ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Great); } else base.CheckForJudgements(userTriggered, timeOffset); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index c525b4bd97..7fd4d11455 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; -using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; using OpenTK.Graphics; @@ -82,7 +81,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables if (!userTriggered) { if (!HitObject.HitWindows.CanBeHit(timeOffset)) - AddJudgement(new OsuJudgement { Result = HitResult.Miss }); + ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss); + return; } @@ -90,10 +90,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables if (result == HitResult.None) return; - AddJudgement(new OsuJudgement - { - Result = result, - }); + ApplyJudgement(HitObject.Judgement, j => j.Result = result); } protected override void UpdatePreemptState() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 5dc141bed0..6e24f1bc83 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { UpdatePreemptState(); - var judgementOffset = Math.Min(HitObject.HitWindows.HalfWindowFor(HitResult.Miss), Judgements.FirstOrDefault()?.TimeOffset ?? 0); + var judgementOffset = Math.Min(HitObject.HitWindows.HalfWindowFor(HitResult.Miss), HitObject.Judgements.FirstOrDefault()?.TimeOffset ?? 0); using (BeginDelayedSequence(HitObject.TimePreempt + judgementOffset, true)) UpdateCurrentState(state); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index 6bff1380d6..809b27e065 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -8,7 +8,6 @@ using osu.Framework.MathUtils; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; using osu.Game.Graphics; -using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; @@ -45,7 +44,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (repeatPoint.StartTime <= Time.Current) - AddJudgement(new OsuJudgement { Result = drawableSlider.Tracking ? HitResult.Great : HitResult.Miss }); + ApplyJudgement(HitObject.Judgement, j => j.Result = drawableSlider.Tracking ? HitResult.Great : HitResult.Miss); } protected override void UpdatePreemptState() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index f1907a92a8..6739c3a822 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -9,7 +9,6 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Configuration; using osu.Game.Rulesets.Scoring; using OpenTK.Graphics; @@ -134,21 +133,25 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { - if (!userTriggered && Time.Current >= slider.EndTime) + if (userTriggered || Time.Current < slider.EndTime) + return; + + ApplyJudgement(HitObject.Judgement, j => { var judgementsCount = NestedHitObjects.Count(); var judgementsHit = NestedHitObjects.Count(h => h.IsHit); var hitFraction = (double)judgementsHit / judgementsCount; - if (hitFraction == 1 && HeadCircle.Judgements.Any(j => j.Result == HitResult.Great)) - AddJudgement(new OsuJudgement { Result = HitResult.Great }); - else if (hitFraction >= 0.5 && HeadCircle.Judgements.Any(j => j.Result >= HitResult.Good)) - AddJudgement(new OsuJudgement { Result = HitResult.Good }); + + if (hitFraction == 1 && HeadCircle.HitObject.Judgement.Result == HitResult.Great) + j.Result = HitResult.Great; + else if (hitFraction >= 0.5 && HeadCircle.HitObject.Judgement.Result >= HitResult.Good) + j.Result = HitResult.Good; else if (hitFraction > 0) - AddJudgement(new OsuJudgement { Result = HitResult.Meh }); + j.Result = HitResult.Meh; else - AddJudgement(new OsuJudgement { Result = HitResult.Miss }); - } + j.Result = HitResult.Miss; + }); } protected override void UpdateCurrentState(ArmedState state) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs index fee663963e..64c4a8ef18 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Objects.Drawables @@ -16,7 +15,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public bool Tracking { get; set; } - public DrawableSliderTail(Slider slider, HitCircle hitCircle) + public DrawableSliderTail(Slider slider, SliderTailCircle hitCircle) : base(hitCircle) { Origin = Anchor.Centre; @@ -32,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (!userTriggered && timeOffset >= 0) - AddJudgement(new OsuSliderTailJudgement { Result = Tracking ? HitResult.Great : HitResult.Miss }); + ApplyJudgement(HitObject.Judgement, j => j.Result = Tracking ? HitResult.Great : HitResult.Miss); } } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index a5ecb63d12..f7b403a5cc 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -6,7 +6,6 @@ using osu.Game.Rulesets.Objects.Drawables; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; -using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; using osu.Framework.Graphics.Containers; @@ -51,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (timeOffset >= 0) - AddJudgement(new OsuJudgement { Result = Tracking ? HitResult.Great : HitResult.Miss }); + ApplyJudgement(HitObject.Judgement, j => j.Result = Tracking ? HitResult.Great : HitResult.Miss); } protected override void UpdatePreemptState() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 1d3df69fb8..4a0303f00f 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -11,7 +11,6 @@ using OpenTK.Graphics; using osu.Game.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Allocation; -using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Screens.Ranking; using osu.Game.Rulesets.Scoring; @@ -136,17 +135,20 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables glow.FadeColour(completeColour, duration); } - if (!userTriggered && Time.Current >= Spinner.EndTime) + if (userTriggered || Time.Current < Spinner.EndTime) + return; + + ApplyJudgement(HitObject.Judgement, j => { if (Progress >= 1) - AddJudgement(new OsuJudgement { Result = HitResult.Great }); + j.Result = HitResult.Great; else if (Progress > .9) - AddJudgement(new OsuJudgement { Result = HitResult.Good }); + j.Result = HitResult.Good; else if (Progress > .75) - AddJudgement(new OsuJudgement { Result = HitResult.Meh }); + j.Result = HitResult.Meh; else if (Time.Current >= Spinner.EndTime) - AddJudgement(new OsuJudgement { Result = HitResult.Miss }); - } + j.Result = HitResult.Miss; + }); } [BackgroundDependencyLoader] diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index 48a6365c00..3927ed02d5 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -2,12 +2,15 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; using OpenTK; using osu.Game.Rulesets.Objects.Types; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Edit.Types; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Osu.Judgements; namespace osu.Game.Rulesets.Osu.Objects { @@ -73,5 +76,11 @@ namespace osu.Game.Rulesets.Osu.Objects public virtual void OffsetPosition(Vector2 offset) => Position += offset; protected override HitWindows CreateHitWindows() => new OsuHitWindows(); + + public OsuJudgement Judgement { get; private set; } + + protected override IEnumerable CreateJudgements() => new[] { Judgement = CreateJudgement() }; + + protected virtual OsuJudgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 698f9de787..972dd42fd6 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -94,7 +94,7 @@ namespace osu.Game.Rulesets.Osu.Objects public double TickDistance; public HitCircle HeadCircle; - public HitCircle TailCircle; + public SliderTailCircle TailCircle; protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) { @@ -133,7 +133,7 @@ namespace osu.Game.Rulesets.Osu.Objects ComboIndex = ComboIndex, }; - TailCircle = new SliderCircle(this) + TailCircle = new SliderTailCircle(this) { StartTime = EndTime, Position = EndPosition, diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs new file mode 100644 index 0000000000..3fae9e9f8a --- /dev/null +++ b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Osu.Judgements; + +namespace osu.Game.Rulesets.Osu.Objects +{ + public class SliderTailCircle : SliderCircle + { + public SliderTailCircle(Slider slider) + : base(slider) + { + } + + protected override OsuJudgement CreateJudgement() => new OsuSliderTailJudgement(); + } +} From e825edb6d7241b64d19e6a2babd4726831caec33 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 2 Aug 2018 15:28:48 +0900 Subject: [PATCH 241/304] Migrate Rulesets.Catch to the new judgement system --- osu.Game.Rulesets.Catch/Objects/Banana.cs | 4 ++++ osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs | 8 ++++++++ .../Objects/Drawable/DrawableBanana.cs | 4 ---- .../Objects/Drawable/DrawableBananaShower.cs | 2 -- .../Objects/Drawable/DrawableCatchHitObject.cs | 9 ++------- .../Objects/Drawable/DrawableDroplet.cs | 3 --- .../Objects/Drawable/DrawableJuiceStream.cs | 2 -- .../Objects/Drawable/DrawableTinyDroplet.cs | 5 +---- osu.Game.Rulesets.Catch/Objects/Droplet.cs | 5 ++++- osu.Game.Rulesets.Catch/Objects/Fruit.cs | 5 ++++- .../Objects/ICatchObjectWithJudgement.cs | 12 ++++++++++++ osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs | 3 +++ 12 files changed, 38 insertions(+), 24 deletions(-) create mode 100644 osu.Game.Rulesets.Catch/Objects/ICatchObjectWithJudgement.cs diff --git a/osu.Game.Rulesets.Catch/Objects/Banana.cs b/osu.Game.Rulesets.Catch/Objects/Banana.cs index f7c60a7a47..d0f4f6c5db 100644 --- a/osu.Game.Rulesets.Catch/Objects/Banana.cs +++ b/osu.Game.Rulesets.Catch/Objects/Banana.cs @@ -1,10 +1,14 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Rulesets.Catch.Judgements; + namespace osu.Game.Rulesets.Catch.Objects { public class Banana : Fruit { public override FruitVisualRepresentation VisualRepresentation => FruitVisualRepresentation.Banana; + + public override CatchJudgement Judgement { get; } = new CatchBananaJudgement(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index d55cdac115..7f2cff561e 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -1,8 +1,10 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; @@ -54,6 +56,12 @@ namespace osu.Game.Rulesets.Catch.Objects } protected override HitWindows CreateHitWindows() => null; + + protected override IEnumerable CreateJudgements() + { + if (this is ICatchObjectWithJudgement judgeable) + yield return judgeable.Judgement; + } } public enum FruitVisualRepresentation diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBanana.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBanana.cs index dd027abbe0..8756a5178f 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBanana.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBanana.cs @@ -1,8 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Catch.Judgements; - namespace osu.Game.Rulesets.Catch.Objects.Drawable { public class DrawableBanana : DrawableFruit @@ -11,7 +9,5 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable : base(h) { } - - protected override CatchJudgement CreateJudgement() => new CatchBananaJudgement(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBananaShower.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBananaShower.cs index f039504600..697fab85c9 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBananaShower.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBananaShower.cs @@ -26,8 +26,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable AddNested(getVisualRepresentation?.Invoke(b)); } - protected override bool ProvidesJudgement => false; - protected override void AddNested(DrawableHitObject h) { ((DrawableCatchHitObject)h).CheckPosition = o => CheckPosition?.Invoke(o) ?? false; diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs index 6ce2e6a2ae..126977ecb2 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs @@ -5,7 +5,6 @@ using System; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; -using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Scoring; @@ -57,16 +56,12 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { if (CheckPosition == null) return; - if (timeOffset >= 0) + if (timeOffset >= 0 && HitObject is ICatchObjectWithJudgement judgeable) { - var judgement = CreateJudgement(); - judgement.Result = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss; - AddJudgement(judgement); + ApplyJudgement(judgeable.Judgement, j => j.Result = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss); } } - protected virtual CatchJudgement CreateJudgement() => new CatchJudgement(); - protected override void SkinChanged(ISkinSource skin, bool allowFallback) { base.SkinChanged(skin, allowFallback); diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs index 11d5ed1f92..5c8a7c4a7c 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces; using OpenTK; using OpenTK.Graphics; -using osu.Game.Rulesets.Catch.Judgements; namespace osu.Game.Rulesets.Catch.Objects.Drawable { @@ -24,8 +23,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable Masking = false; } - protected override CatchJudgement CreateJudgement() => new CatchDropletJudgement(); - [BackgroundDependencyLoader] private void load() { diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableJuiceStream.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableJuiceStream.cs index 854b63edeb..e66852c5c2 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableJuiceStream.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableJuiceStream.cs @@ -26,8 +26,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable AddNested(getVisualRepresentation?.Invoke(o)); } - protected override bool ProvidesJudgement => false; - protected override void AddNested(DrawableHitObject h) { var catchObject = (DrawableCatchHitObject)h; diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableTinyDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableTinyDroplet.cs index 2232bb81a7..e0f02454c4 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableTinyDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableTinyDroplet.cs @@ -2,18 +2,15 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Game.Rulesets.Catch.Judgements; namespace osu.Game.Rulesets.Catch.Objects.Drawable { public class DrawableTinyDroplet : DrawableDroplet { - public DrawableTinyDroplet(Droplet h) + public DrawableTinyDroplet(TinyDroplet h) : base(h) { Size = new Vector2((float)CatchHitObject.OBJECT_RADIUS) / 8; } - - protected override CatchJudgement CreateJudgement() => new CatchTinyDropletJudgement(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/Droplet.cs b/osu.Game.Rulesets.Catch/Objects/Droplet.cs index f91a70c506..e92b06d0d1 100644 --- a/osu.Game.Rulesets.Catch/Objects/Droplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Droplet.cs @@ -1,9 +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.Catch.Judgements; + namespace osu.Game.Rulesets.Catch.Objects { - public class Droplet : CatchHitObject + public class Droplet : CatchHitObject, ICatchObjectWithJudgement { + public virtual CatchJudgement Judgement { get; } = new CatchDropletJudgement(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/Fruit.cs b/osu.Game.Rulesets.Catch/Objects/Fruit.cs index fcbb339ffd..4bcb1a400f 100644 --- a/osu.Game.Rulesets.Catch/Objects/Fruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Fruit.cs @@ -1,9 +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.Catch.Judgements; + namespace osu.Game.Rulesets.Catch.Objects { - public class Fruit : CatchHitObject + public class Fruit : CatchHitObject, ICatchObjectWithJudgement { + public virtual CatchJudgement Judgement { get; } = new CatchJudgement(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/ICatchObjectWithJudgement.cs b/osu.Game.Rulesets.Catch/Objects/ICatchObjectWithJudgement.cs new file mode 100644 index 0000000000..2aa5a5c83a --- /dev/null +++ b/osu.Game.Rulesets.Catch/Objects/ICatchObjectWithJudgement.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.Catch.Judgements; + +namespace osu.Game.Rulesets.Catch.Objects +{ + public interface ICatchObjectWithJudgement + { + CatchJudgement Judgement { get; } + } +} diff --git a/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs b/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs index 76cc8d9808..d7cc002dfc 100644 --- a/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs @@ -1,9 +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.Catch.Judgements; + namespace osu.Game.Rulesets.Catch.Objects { public class TinyDroplet : Droplet { + public override CatchJudgement Judgement { get; } = new CatchTinyDropletJudgement(); } } From 1b7b6f341cdbcc4b1791fc1532470af021bf03e7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 2 Aug 2018 16:09:04 +0900 Subject: [PATCH 242/304] Migrate Rulesets.Taiko to the new judgement system --- .../TaikoIntermediateSwellJudgement.cs | 5 --- .../Judgements/TaikoStrongHitJudgement.cs | 5 --- .../Objects/Drawables/DrawableDrumRoll.cs | 11 ++++--- .../Objects/Drawables/DrawableDrumRollTick.cs | 20 +++++++---- .../Objects/Drawables/DrawableHit.cs | 21 ++---------- .../Objects/Drawables/DrawableHitStrong.cs | 17 ++++++---- .../Objects/Drawables/DrawableSwell.cs | 33 ++++++++++++++----- osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs | 14 ++++++++ .../Objects/DrumRollTick.cs | 15 +++++++++ osu.Game.Rulesets.Taiko/Objects/Hit.cs | 14 ++++++++ osu.Game.Rulesets.Taiko/Objects/Swell.cs | 21 ++++++++++++ 11 files changed, 122 insertions(+), 54 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoIntermediateSwellJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoIntermediateSwellJudgement.cs index 608f1f9be2..adcf4572c5 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoIntermediateSwellJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoIntermediateSwellJudgement.cs @@ -11,11 +11,6 @@ namespace osu.Game.Rulesets.Taiko.Judgements public override bool AffectsCombo => false; - public TaikoIntermediateSwellJudgement() - { - Final = false; - } - /// /// Computes the numeric result value for the combo portion of the score. /// diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs index 288ad236aa..b69bbd4fd8 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs @@ -6,10 +6,5 @@ namespace osu.Game.Rulesets.Taiko.Judgements public class TaikoStrongHitJudgement : TaikoJudgement { public override bool AffectsCombo => false; - - public TaikoStrongHitJudgement() - { - Final = true; - } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs index 00eac4adca..57c0f55a59 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -6,7 +6,6 @@ using osu.Framework.Allocation; using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Taiko.Judgements; using OpenTK; using OpenTK.Graphics; using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; @@ -85,12 +84,16 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables int countHit = NestedHitObjects.Count(o => o.IsHit); if (countHit >= HitObject.RequiredGoodHits) { - AddJudgement(new TaikoJudgement { Result = countHit >= HitObject.RequiredGreatHits ? HitResult.Great : HitResult.Good }); + ApplyJudgement(HitObject.Judgement, j => j.Result = countHit >= HitObject.RequiredGreatHits ? HitResult.Great : HitResult.Good); if (HitObject.IsStrong) - AddJudgement(new TaikoStrongHitJudgement()); + ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Great); } else - AddJudgement(new TaikoJudgement { Result = HitResult.Miss }); + { + ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss); + if (HitObject.IsStrong) + ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Miss); + } } protected override void UpdateState(ArmedState state) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs index 7a57cf77b4..86853afc35 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs @@ -5,7 +5,6 @@ using System; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; -using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Taiko.Objects.Drawables @@ -28,14 +27,23 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (!userTriggered) + { + if (timeOffset > HitObject.HitWindow) + { + ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss); + if (HitObject.IsStrong) + ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Miss); + } + + return; + } + + if (Math.Abs(timeOffset) > HitObject.HitWindow) return; - if (!(Math.Abs(timeOffset) < HitObject.HitWindow)) - return; - - AddJudgement(new TaikoDrumRollTickJudgement { Result = HitResult.Great }); + ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Great); if (HitObject.IsStrong) - AddJudgement(new TaikoStrongHitJudgement()); + ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Great); } protected override void UpdateState(ArmedState state) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index bb9cd02b14..f7a170d838 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -5,7 +5,6 @@ using System.Linq; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; -using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Taiko.Objects.Drawables @@ -17,11 +16,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables /// protected abstract TaikoAction[] HitActions { get; } - /// - /// Whether a second hit is allowed to be processed. This occurs once this hit object has been hit successfully. - /// - protected bool SecondHitAllowed { get; private set; } - /// /// Whether the last key pressed is a valid hit key. /// @@ -38,7 +32,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables if (!userTriggered) { if (!HitObject.HitWindows.CanBeHit(timeOffset)) - AddJudgement(new TaikoJudgement { Result = HitResult.Miss }); + ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss); return; } @@ -47,17 +41,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables return; if (!validKeyPressed || result == HitResult.Miss) - AddJudgement(new TaikoJudgement { Result = HitResult.Miss }); + ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss); else - { - AddJudgement(new TaikoJudgement - { - Result = result, - Final = !HitObject.IsStrong - }); - - SecondHitAllowed = true; - } + ApplyJudgement(HitObject.Judgement, j => j.Result = result); } public override bool OnPressed(TaikoAction action) @@ -86,7 +72,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables switch (State.Value) { case ArmedState.Idle: - SecondHitAllowed = false; validKeyPressed = false; UnproxyContent(); diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs index b431d35e16..ede13aadce 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs @@ -5,7 +5,6 @@ using System; using System.Linq; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; -using osu.Game.Rulesets.Taiko.Judgements; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { @@ -28,23 +27,27 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { - if (!SecondHitAllowed) + if (!HitObject.Judgement.HasResult) { base.CheckForJudgements(userTriggered, timeOffset); return; } + if (!HitObject.Judgement.IsHit) + { + ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Miss); + return; + } + if (!userTriggered) { if (timeOffset > second_hit_window) - AddJudgement(new TaikoStrongHitJudgement { Result = HitResult.None }); + ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Miss); return; } - // If we get here, we're assured that the key pressed is the correct secondary key - if (Math.Abs(firstHitTime - Time.Current) < second_hit_window) - AddJudgement(new TaikoStrongHitJudgement { Result = HitResult.Great }); + ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Great); } protected override void UpdateState(ArmedState state) @@ -73,7 +76,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables return false; // Check if we've handled the first key - if (!SecondHitAllowed) + if (!HitObject.Judgement.HasResult) { // First key hasn't been handled yet, attempt to handle it bool handled = base.OnPressed(action); diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 408b37e377..f44e70d11d 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -12,7 +13,6 @@ using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; -using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Taiko.Objects.Drawables @@ -128,9 +128,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { if (userTriggered) { - AddJudgement(new TaikoIntermediateSwellJudgement()); + var nextIntermediate = HitObject.IntermediateJudgements.FirstOrDefault(j => !j.HasResult); - var completion = (float)Judgements.Count / HitObject.RequiredHits; + if (nextIntermediate != null) + ApplyJudgement(nextIntermediate, j => j.Result = HitResult.Great); + + var numHits = HitObject.IntermediateJudgements.Count(j => j.HasResult); + + var completion = (float)numHits / HitObject.RequiredHits; expandingRing .FadeTo(expandingRing.Alpha + MathHelper.Clamp(completion / 16, 0.1f, 0.6f), 50) @@ -141,18 +146,28 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables expandingRing.ScaleTo(1f + Math.Min(target_ring_scale - 1f, (target_ring_scale - 1f) * completion * 1.3f), 260, Easing.OutQuint); - if (Judgements.Count == HitObject.RequiredHits) - AddJudgement(new TaikoJudgement { Result = HitResult.Great }); + if (numHits == HitObject.RequiredHits) + ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Great); } else { if (timeOffset < 0) return; - //TODO: THIS IS SHIT AND CAN'T EXIST POST-TAIKO WORLD CUP - AddJudgement(Judgements.Count > HitObject.RequiredHits / 2 - ? new TaikoJudgement { Result = HitResult.Good } - : new TaikoJudgement { Result = HitResult.Miss }); + int numHits = 0; + + foreach (var intermediate in HitObject.IntermediateJudgements) + { + if (intermediate.HasResult) + { + numHits++; + continue; + } + + ApplyJudgement(intermediate, j => j.Result = HitResult.Miss); + } + + ApplyJudgement(HitObject.Judgement, j => j.Result = numHits > HitObject.RequiredHits / 2 ? HitResult.Good : HitResult.Miss); } } diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs index 4c9ec5473b..b6b1efee16 100644 --- a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs @@ -3,8 +3,11 @@ using osu.Game.Rulesets.Objects.Types; using System; +using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Taiko.Judgements; namespace osu.Game.Rulesets.Taiko.Objects { @@ -81,5 +84,16 @@ namespace osu.Game.Rulesets.Taiko.Objects first = false; } } + + public TaikoJudgement Judgement { get; private set; } + public TaikoStrongHitJudgement StrongJudgement { get; private set; } + + protected override IEnumerable CreateJudgements() + { + yield return Judgement = new TaikoJudgement(); + + if (IsStrong) + yield return StrongJudgement = new TaikoStrongHitJudgement(); + } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs index e546d6427f..58f6a2840a 100644 --- a/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs @@ -1,6 +1,10 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Taiko.Judgements; + namespace osu.Game.Rulesets.Taiko.Objects { public class DrumRollTick : TaikoHitObject @@ -20,5 +24,16 @@ namespace osu.Game.Rulesets.Taiko.Objects /// The time allowed to hit this tick. /// public double HitWindow => TickSpacing / 2; + + public TaikoDrumRollTickJudgement Judgement { get; private set; } + public TaikoStrongHitJudgement StrongJudgement { get; private set; } + + protected override IEnumerable CreateJudgements() + { + yield return Judgement = new TaikoDrumRollTickJudgement(); + + if (IsStrong) + yield return StrongJudgement = new TaikoStrongHitJudgement(); + } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Hit.cs b/osu.Game.Rulesets.Taiko/Objects/Hit.cs index 0b47aa490b..94fc1ab20f 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Hit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Hit.cs @@ -1,9 +1,23 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Taiko.Judgements; + namespace osu.Game.Rulesets.Taiko.Objects { public class Hit : TaikoHitObject { + public TaikoJudgement Judgement { get; private set; } + public TaikoStrongHitJudgement StrongJudgement { get; private set; } + + protected override IEnumerable CreateJudgements() + { + yield return Judgement = new TaikoJudgement(); + + if (IsStrong) + yield return StrongJudgement = new TaikoStrongHitJudgement(); + } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs index eb6f931af4..0985853dd6 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Swell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs @@ -1,7 +1,10 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Taiko.Judgements; namespace osu.Game.Rulesets.Taiko.Objects { @@ -15,5 +18,23 @@ namespace osu.Game.Rulesets.Taiko.Objects /// The number of hits required to complete the swell successfully. /// public int RequiredHits = 10; + + public TaikoJudgement Judgement { get; private set; } + + private readonly List intermediateJudgements = new List(); + public IReadOnlyList IntermediateJudgements => intermediateJudgements; + + protected override IEnumerable CreateJudgements() + { + yield return Judgement = new TaikoJudgement(); + + for (int i = 0; i < RequiredHits; i++) + { + var intermediate = new TaikoIntermediateSwellJudgement(); + intermediateJudgements.Add(intermediate); + + yield return intermediate; + } + } } } From cd70e5e30b24301b071f481d51e3d9510fe5fe44 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 2 Aug 2018 16:44:01 +0900 Subject: [PATCH 243/304] Migrate Rulesets.Mania to the new judgement system --- .../Objects/Drawables/DrawableHoldNote.cs | 16 ++++++------- .../Objects/Drawables/DrawableHoldNoteTick.cs | 23 ++++--------------- .../Objects/Drawables/DrawableNote.cs | 5 ++-- osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 9 +++++++- .../Objects/HoldNoteTick.cs | 7 ++++++ osu.Game.Rulesets.Mania/Objects/Note.cs | 7 ++++++ osu.Game.Rulesets.Mania/Objects/TailNote.cs | 12 ++++++++++ 7 files changed, 49 insertions(+), 30 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/Objects/TailNote.cs diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index 597450f223..2e64c1796a 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (tail.AllJudged) - AddJudgement(new HoldNoteJudgement { Result = HitResult.Perfect }); + ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Perfect); } protected override void Update() @@ -166,7 +166,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables return false; // If the key has been released too early, the user should not receive full score for the release - if (Judgements.Any(j => j.Result == HitResult.Miss)) + if (HitObject.Judgement.Result == HitResult.Miss) holdNote.hasBroken = true; // The head note also handles early hits before the body, but we want accurate early hits to count as the body being held @@ -206,10 +206,10 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables { if (!HitObject.HitWindows.CanBeHit(timeOffset)) { - AddJudgement(new HoldNoteTailJudgement + ApplyJudgement(holdNote.HitObject.Tail.Judgement, j => { - Result = HitResult.Miss, - HasBroken = holdNote.hasBroken + j.Result = HitResult.Miss; + ((HoldNoteTailJudgement)j).HasBroken = holdNote.hasBroken; }); } @@ -220,10 +220,10 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (result == HitResult.None) return; - AddJudgement(new HoldNoteTailJudgement + ApplyJudgement(holdNote.HitObject.Tail.Judgement, j => { - Result = result, - HasBroken = holdNote.hasBroken + j.Result = result; + ((HoldNoteTailJudgement)j).HasBroken = holdNote.hasBroken; }); } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs index 5df6079efa..c281045591 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs @@ -7,7 +7,6 @@ using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets.Mania.Judgements; using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets.Scoring; @@ -74,27 +73,15 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { - if (!userTriggered) - return; - if (Time.Current < HitObject.StartTime) return; - if (HoldStartTime?.Invoke() > HitObject.StartTime) - return; + var startTime = HoldStartTime?.Invoke(); - AddJudgement(new HoldNoteTickJudgement { Result = HitResult.Perfect }); - } - - protected override void Update() - { - if (AllJudged) - return; - - if (HoldStartTime?.Invoke() == null) - return; - - UpdateJudgement(true); + if (startTime == null || startTime > HitObject.StartTime) + ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss); + else + ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Perfect); } } } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index 18084c4c08..bc1033bead 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs @@ -6,7 +6,6 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Bindings; -using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI.Scrolling; @@ -61,7 +60,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (!userTriggered) { if (!HitObject.HitWindows.CanBeHit(timeOffset)) - AddJudgement(new ManiaJudgement { Result = HitResult.Miss }); + ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss); return; } @@ -69,7 +68,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (result == HitResult.None) return; - AddJudgement(new ManiaJudgement { Result = result }); + ApplyJudgement(HitObject.Judgement, j => j.Result = result); } public virtual bool OnPressed(ManiaAction action) diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index 22fa93a308..033434a989 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -1,8 +1,11 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Mania.Objects @@ -55,7 +58,7 @@ namespace osu.Game.Rulesets.Mania.Objects /// /// The tail note of the hold. /// - public readonly Note Tail = new Note(); + public readonly TailNote Tail = new TailNote(); /// /// The time between ticks of this hold. @@ -94,5 +97,9 @@ namespace osu.Game.Rulesets.Mania.Objects }); } } + + public HoldNoteJudgement Judgement { get; private set; } + + protected override IEnumerable CreateJudgements() => new[] { Judgement = new HoldNoteJudgement() }; } } diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs index d078c15c92..73ad3d94ec 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs @@ -1,6 +1,10 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Mania.Judgements; + namespace osu.Game.Rulesets.Mania.Objects { /// @@ -8,5 +12,8 @@ namespace osu.Game.Rulesets.Mania.Objects /// public class HoldNoteTick : ManiaHitObject { + public HoldNoteTickJudgement Judgement { get; private set; } + + protected override IEnumerable CreateJudgements() => new[] { Judgement = new HoldNoteTickJudgement() }; } } diff --git a/osu.Game.Rulesets.Mania/Objects/Note.cs b/osu.Game.Rulesets.Mania/Objects/Note.cs index 975188e550..ebda40de85 100644 --- a/osu.Game.Rulesets.Mania/Objects/Note.cs +++ b/osu.Game.Rulesets.Mania/Objects/Note.cs @@ -1,6 +1,10 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Mania.Judgements; + namespace osu.Game.Rulesets.Mania.Objects { /// @@ -8,5 +12,8 @@ namespace osu.Game.Rulesets.Mania.Objects /// public class Note : ManiaHitObject { + public virtual ManiaJudgement Judgement { get; } = new ManiaJudgement(); + + protected override IEnumerable CreateJudgements() => new[] { Judgement }; } } diff --git a/osu.Game.Rulesets.Mania/Objects/TailNote.cs b/osu.Game.Rulesets.Mania/Objects/TailNote.cs new file mode 100644 index 0000000000..530f3c6ff1 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Objects/TailNote.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.Mania.Judgements; + +namespace osu.Game.Rulesets.Mania.Objects +{ + public class TailNote : Note + { + public override ManiaJudgement Judgement { get; } = new HoldNoteTailJudgement(); + } +} From 4a11f2ec2ac4114cc3c89a843ff45d1700a3adef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Aug 2018 18:16:36 +0900 Subject: [PATCH 244/304] Improve UX when adjusting visual settings at loading screen --- osu.Game/Screens/Play/PlayerLoader.cs | 32 +++++++++++++++++-- .../PlayerSettings/PlayerSettingsGroup.cs | 22 ++++++++++++- .../Play/ScreenWithBeatmapBackground.cs | 17 ++++++++-- 3 files changed, 65 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 97a728ffb7..e9aa012cd7 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -1,11 +1,13 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.States; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Framework.Threading; @@ -20,6 +22,8 @@ namespace osu.Game.Screens.Play { public class PlayerLoader : ScreenWithBeatmapBackground { + private static readonly Vector2 background_blur = new Vector2(15); + private Player player; private BeatmapMetadataDisplay info; @@ -60,7 +64,7 @@ namespace osu.Game.Screens.Play Margin = new MarginPadding(25), Children = new PlayerSettingsGroup[] { - new VisualSettings(), + visualSettings = new VisualSettings(), new InputSettings() } }); @@ -122,9 +126,33 @@ namespace osu.Game.Screens.Play } private ScheduledDelegate pushDebounce; + private VisualSettings visualSettings; private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && GetContainingInputManager()?.DraggedDrawable == null; + protected override bool OnHover(InputState state) + { + // restore our screen defaults + InitializeBackgroundElements(); + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + if (GetContainingInputManager().HoveredDrawables.Contains(visualSettings)) + { + // show user setting preview + UpdateBackgroundElements(); + } + base.OnHoverLost(state); + } + + protected override void InitializeBackgroundElements() + { + Background?.FadeTo(1, BACKGROUND_FADE_DURATION, Easing.OutQuint); + Background?.BlurTo(background_blur, BACKGROUND_FADE_DURATION, Easing.OutQuint); + } + private void pushWhenLoaded() { if (!IsCurrentScreen) return; @@ -215,7 +243,7 @@ namespace osu.Game.Screens.Play Anchor = Anchor.TopCentre, Origin = Anchor.TopRight, Margin = new MarginPadding { Right = 5 }, - Colour = OsuColour.Gray(0.5f), + Colour = OsuColour.Gray(0.8f), Text = left, }, new OsuSpriteText diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index c4767f404d..64c49099f2 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -128,6 +128,27 @@ namespace osu.Game.Screens.Play.PlayerSettings }; } + private const float fade_duration = 800; + private const float inactive_alpha = 0.5f; + + protected override void LoadComplete() + { + base.LoadComplete(); + this.Delay(600).FadeTo(inactive_alpha, fade_duration, Easing.OutQuint); + } + + protected override bool OnHover(InputState state) + { + this.FadeIn(fade_duration, Easing.OutQuint); + return true; + } + + protected override void OnHoverLost(InputState state) + { + this.FadeTo(inactive_alpha, fade_duration, Easing.OutQuint); + base.OnHoverLost(state); + } + [BackgroundDependencyLoader] private void load(OsuColour colours) { @@ -140,7 +161,6 @@ namespace osu.Game.Screens.Play.PlayerSettings protected override Container Content => content; - protected override bool OnHover(InputState state) => true; protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; } } diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 7f18305b1c..26d3218fbf 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -15,6 +15,8 @@ namespace osu.Game.Screens.Play { protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value); + protected new BackgroundScreenBeatmap Background => (BackgroundScreenBeatmap)base.Background; + public override bool AllowBeatmapRulesetChange => false; protected const float BACKGROUND_FADE_DURATION = 800; @@ -43,21 +45,30 @@ namespace osu.Game.Screens.Play DimLevel.ValueChanged += _ => UpdateBackgroundElements(); BlurLevel.ValueChanged += _ => UpdateBackgroundElements(); ShowStoryboard.ValueChanged += _ => UpdateBackgroundElements(); - UpdateBackgroundElements(); + InitializeBackgroundElements(); } protected override void OnResuming(Screen last) { base.OnResuming(last); - UpdateBackgroundElements(); + InitializeBackgroundElements(); } + /// + /// Called once on entering screen. By Default, performs a full call. + /// + protected virtual void InitializeBackgroundElements() => UpdateBackgroundElements(); + + /// + /// Called wen background elements require updates, usually due to a user changing a setting. + /// + /// protected virtual void UpdateBackgroundElements() { if (!IsCurrentScreen) return; Background?.FadeTo(BackgroundOpacity, BACKGROUND_FADE_DURATION, Easing.OutQuint); - (Background as BackgroundScreenBeatmap)?.BlurTo(new Vector2((float)BlurLevel.Value * 25), BACKGROUND_FADE_DURATION, Easing.OutQuint); + Background?.BlurTo(new Vector2((float)BlurLevel.Value * 25), BACKGROUND_FADE_DURATION, Easing.OutQuint); } } } From 7097ecb740bfb26d3a9061b393cf8df3ea3450e7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Aug 2018 19:08:23 +0900 Subject: [PATCH 245/304] Fix discrepancies in how elements of play mode fade when restarting/exiting --- osu.Game/Screens/Play/Player.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index cc649960ea..2e23bb16f0 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -213,7 +213,7 @@ namespace osu.Game.Screens.Play { if (!IsCurrentScreen) return; - pauseContainer.Hide(); + fadeOut(true); Restart(); }, } @@ -364,16 +364,10 @@ namespace osu.Game.Screens.Play return true; } - private void fadeOut() + private void fadeOut(bool instant = false) { - const float fade_out_duration = 250; - - RulesetContainer?.FadeOut(fade_out_duration); - Content.FadeOut(fade_out_duration); - - hudOverlay?.ScaleTo(0.7f, fade_out_duration * 3, Easing.In); - - Background?.FadeTo(1f, fade_out_duration); + float fadeOutDuration = instant ? 0 : 250; + Content.FadeOut(fadeOutDuration); } protected override bool OnScroll(InputState state) => mouseWheelDisabled.Value && !pauseContainer.IsPaused; From b1afcf0e5d6bc14e57a8ed7e15f12a9417022bff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Aug 2018 19:47:50 +0900 Subject: [PATCH 246/304] Add loading animation to player loader to make it more obvious when loading is complete --- osu.Game.Tests/Visual/TestCasePlayerLoader.cs | 40 ++++++++++++++++++- osu.Game/Screens/Play/PlayerLoader.cs | 36 +++++++++++++++-- 2 files changed, 70 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlayerLoader.cs b/osu.Game.Tests/Visual/TestCasePlayerLoader.cs index 52a9db080d..de839a21af 100644 --- a/osu.Game.Tests/Visual/TestCasePlayerLoader.cs +++ b/osu.Game.Tests/Visual/TestCasePlayerLoader.cs @@ -1,25 +1,61 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Threading; using osu.Framework.Allocation; using osu.Game.Beatmaps; using osu.Game.Screens.Play; namespace osu.Game.Tests.Visual { - public class TestCasePlayerLoader : OsuTestCase + public class TestCasePlayerLoader : ManualInputManagerTestCase { + private PlayerLoader loader; + [BackgroundDependencyLoader] private void load(OsuGameBase game) { Beatmap.Value = new DummyWorkingBeatmap(game); - AddStep("load dummy beatmap", () => Add(new PlayerLoader(new Player + AddStep("load dummy beatmap", () => Add(loader = new PlayerLoader(new Player { AllowPause = false, AllowLeadIn = false, AllowResults = false, }))); + + AddStep("mouse in centre", () => InputManager.MoveMouseTo(loader.ScreenSpaceDrawQuad.Centre)); + + AddUntilStep(() => !loader.IsCurrentScreen, "wait for no longer current"); + + AddStep("load slow dummy beatmap", () => + { + SlowLoadPlayer slow; + + Add(loader = new PlayerLoader(slow = new SlowLoadPlayer + { + AllowPause = false, + AllowLeadIn = false, + AllowResults = false, + })); + + Scheduler.AddDelayed(() => slow.Ready = true, 5000); + }); + + AddUntilStep(() => !loader.IsCurrentScreen, "wait for no longer current"); + } + + protected class SlowLoadPlayer : Player + { + public bool Ready; + + [BackgroundDependencyLoader] + private void load() + { + while (!Ready) + Thread.Sleep(1); + } } } + } diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 97a728ffb7..cc2ba3b06a 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -12,9 +12,11 @@ using osu.Framework.Threading; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Menu; using osu.Game.Screens.Play.PlayerSettings; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Screens.Play { @@ -65,21 +67,25 @@ namespace osu.Game.Screens.Play } }); - loadTask = LoadComponentAsync(player); + loadTask = LoadComponentAsync(player, playerLoaded); } + private void playerLoaded(Player player) => info.Loading = false; + protected override void OnResuming(Screen last) { base.OnResuming(last); contentIn(); + info.Loading = true; + //we will only be resumed if the player has requested a re-run (see ValidForResume setting above) loadTask = LoadComponentAsync(player = new Player { RestartCount = player.RestartCount + 1, RestartRequested = player.RestartRequested, - }); + }, playerLoaded); this.Delay(400).Schedule(pushWhenLoaded); } @@ -230,6 +236,25 @@ namespace osu.Game.Screens.Play } private readonly WorkingBeatmap beatmap; + private LoadingAnimation loading; + private Sprite backgroundSprite; + + public bool Loading + { + set + { + if (value) + { + loading.Show(); + backgroundSprite.FadeColour(OsuColour.Gray(0.5f), 400, Easing.OutQuint); + } + else + { + loading.Hide(); + backgroundSprite.FadeColour(Color4.White, 400, Easing.OutQuint); + } + } + } public BeatmapMetadataDisplay(WorkingBeatmap beatmap) { @@ -276,9 +301,9 @@ namespace osu.Game.Screens.Play Anchor = Anchor.TopCentre, CornerRadius = 10, Masking = true, - Children = new[] + Children = new Drawable[] { - new Sprite + backgroundSprite = new Sprite { RelativeSizeAxes = Axes.Both, Texture = beatmap?.Background, @@ -286,6 +311,7 @@ namespace osu.Game.Screens.Play Anchor = Anchor.Centre, FillMode = FillMode.Fill, }, + loading = new LoadingAnimation { Scale = new Vector2(1.3f) } } }, new OsuSpriteText @@ -313,6 +339,8 @@ namespace osu.Game.Screens.Play }, } }; + + Loading = true; } } } From 3619290c34f404f822b49b74852ecb76ea876fd7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 2 Aug 2018 20:35:54 +0900 Subject: [PATCH 247/304] Split out judgement definition from judgement result --- .../Rulesets/Judgements/DrawableJudgement.cs | 16 ++-- osu.Game/Rulesets/Judgements/Judgement.cs | 56 +++--------- .../Rulesets/Judgements/JudgementResult.cs | 51 +++++++++++ .../Objects/Drawables/DrawableHitObject.cs | 49 +++++++---- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 88 +++++++++++-------- osu.Game/Rulesets/UI/RulesetContainer.cs | 8 +- .../Screens/Play/HUD/StandardHealthDisplay.cs | 4 +- 7 files changed, 161 insertions(+), 111 deletions(-) create mode 100644 osu.Game/Rulesets/Judgements/JudgementResult.cs diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index 5de14ae579..65b2ef75c4 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Judgements private OsuColour colours; - protected readonly Judgement Judgement; + protected readonly JudgementResult Result; public readonly DrawableHitObject JudgedObject; @@ -34,11 +34,11 @@ namespace osu.Game.Rulesets.Judgements /// /// Creates a drawable which visualises a . /// - /// The judgement to visualise. + /// The judgement to visualise. /// The object which was judged. - public DrawableJudgement(Judgement judgement, DrawableHitObject judgedObject) + public DrawableJudgement(JudgementResult result, DrawableHitObject judgedObject) { - Judgement = judgement; + Result = result; JudgedObject = judgedObject; Size = new Vector2(judgement_size); @@ -49,11 +49,11 @@ namespace osu.Game.Rulesets.Judgements { this.colours = colours; - Child = new SkinnableDrawable($"Play/{Judgement.Result}", _ => JudgementText = new OsuSpriteText + Child = new SkinnableDrawable($"Play/{Result.Type}", _ => JudgementText = new OsuSpriteText { - Text = Judgement.Result.GetDescription().ToUpperInvariant(), + Text = Result.Type.GetDescription().ToUpperInvariant(), Font = @"Venera", - Colour = judgementColour(Judgement.Result), + Colour = judgementColour(Result.Type), Scale = new Vector2(0.85f, 1), TextSize = 12 }, restrictSize: false); @@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Judgements this.FadeInFromZero(100, Easing.OutQuint); - switch (Judgement.Result) + switch (Result.Type) { case HitResult.None: break; diff --git a/osu.Game/Rulesets/Judgements/Judgement.cs b/osu.Game/Rulesets/Judgements/Judgement.cs index 63378e57cc..5fddbe0b0a 100644 --- a/osu.Game/Rulesets/Judgements/Judgement.cs +++ b/osu.Game/Rulesets/Judgements/Judgement.cs @@ -1,74 +1,44 @@ // 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; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Judgements { public class Judgement { - /// - /// Whether this judgement is the result of a hit or a miss. - /// - public HitResult Result; - /// /// The maximum that can be achieved. /// public virtual HitResult MaxResult => HitResult.Perfect; /// - /// The combo prior to this judgement occurring. - /// - public int ComboAtJudgement; - - /// - /// The highest combo achieved prior to this judgement occurring. - /// - public int HighestComboAtJudgement; - - /// - /// Whether this has a result. - /// - public bool HasResult => Result > HitResult.None; - - /// - /// Whether a successful hit occurred. - /// - public bool IsHit => Result > HitResult.Miss; - - /// - /// The offset from a perfect hit at which this judgement occurred. - /// Populated when added via . - /// - public double TimeOffset { get; set; } - - /// - /// Whether the should affect the current combo. + /// Whether this should affect the current combo. /// public virtual bool AffectsCombo => true; /// - /// Whether the should be counted as base (combo) or bonus score. + /// Whether this should be counted as base (combo) or bonus score. /// public virtual bool IsBonus => !AffectsCombo; /// - /// The numeric representation for the result achieved. - /// - public int NumericResult => NumericResultFor(Result); - - /// - /// The numeric representation for the maximum achievable result. + /// The numeric score representation for the maximum achievable result. /// public int MaxNumericResult => NumericResultFor(MaxResult); /// - /// Convert a to a numeric score representation. + /// Retrieves the numeric score representation of a . /// - /// The value to convert. - /// The number. + /// The to find the numeric score representation for. + /// The numeric score representation of . protected virtual int NumericResultFor(HitResult result) => result > HitResult.Miss ? 1 : 0; + + /// + /// Retrieves the numeric score representation of a . + /// + /// The to find the numeric score representation for. + /// The numeric score representation of . + public int NumericResultFor(JudgementResult result) => NumericResultFor(result.Type); } } diff --git a/osu.Game/Rulesets/Judgements/JudgementResult.cs b/osu.Game/Rulesets/Judgements/JudgementResult.cs new file mode 100644 index 0000000000..6971fcf593 --- /dev/null +++ b/osu.Game/Rulesets/Judgements/JudgementResult.cs @@ -0,0 +1,51 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Judgements +{ + public class JudgementResult + { + /// + /// Whether this is the result of a hit or a miss. + /// + public HitResult Type; + + /// + /// The which this applies for. + /// + public readonly Judgement Judgement; + + /// + /// The offset from a perfect hit at which this occurred. + /// Populated when added via . + /// + public double TimeOffset { get; internal set; } + + /// + /// The combo prior to this judgement occurring. + /// + public int ComboAtJudgement { get; internal set; } + + /// + /// The highest combo achieved prior to this judgement occurring. + /// + public int HighestComboAtJudgement { get; internal set; } + + /// + /// Whether this has a result. + /// + public bool HasResult => Type > HitResult.None; + + /// + /// Whether a successful hit occurred. + /// + public bool IsHit => Type > HitResult.Miss; + + public JudgementResult(Judgement judgement) + { + Judgement = judgement; + } + } +} diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index b767834e5d..27de18177f 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -35,8 +35,8 @@ namespace osu.Game.Rulesets.Objects.Drawables private readonly Lazy> nestedHitObjects = new Lazy>(); public IEnumerable NestedHitObjects => nestedHitObjects.IsValueCreated ? nestedHitObjects.Value : Enumerable.Empty(); - public event Action OnJudgement; - public event Action OnJudgementRemoved; + public event Action OnJudgement; + public event Action OnJudgementRemoved; /// /// Whether a visible judgement should be displayed when this representation is hit. @@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Objects.Drawables /// /// Whether this and all of its nested s have been hit. /// - public bool IsHit => HitObject.Judgements.All(j => j.IsHit) && NestedHitObjects.All(n => n.IsHit); + public bool IsHit => Results.All(j => j.IsHit) && NestedHitObjects.All(n => n.IsHit); /// /// Whether this and all of its nested s have been judged. @@ -57,7 +57,10 @@ namespace osu.Game.Rulesets.Objects.Drawables /// Whether this has been judged. /// Note: This does NOT include nested hitobjects. /// - public bool Judged => HitObject.Judgements.All(h => h.HasResult); + public bool Judged => Results.All(h => h.HasResult); + + private readonly List results = new List(); + public IReadOnlyList Results => results; private bool judgementOccurred; @@ -74,6 +77,9 @@ namespace osu.Game.Rulesets.Objects.Drawables protected DrawableHitObject(HitObject hitObject) { HitObject = hitObject; + + foreach (var j in hitObject.Judgements) + results.Add(CreateJudgementResult(j)); } [BackgroundDependencyLoader] @@ -135,17 +141,17 @@ namespace osu.Game.Rulesets.Objects.Drawables { var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; - for (int i = HitObject.Judgements.Count - 1; i >= 0; i--) + for (int i = Results.Count - 1; i >= 0; i--) { - var judgement = HitObject.Judgements[i]; + var judgement = Results[i]; if (judgement.TimeOffset + endTime <= Time.Current) break; - judgement.Result = HitResult.None; - State.Value = ArmedState.Idle; - OnJudgementRemoved?.Invoke(this, judgement); + + judgement.Type = HitResult.None; + State.Value = ArmedState.Idle; } } @@ -161,8 +167,8 @@ namespace osu.Game.Rulesets.Objects.Drawables protected virtual void AddNested(DrawableHitObject h) { - h.OnJudgement += (d, j) => OnJudgement?.Invoke(d, j); - h.OnJudgementRemoved += (d, j) => OnJudgementRemoved?.Invoke(d, j); + h.OnJudgement += (d, r) => OnJudgement?.Invoke(d, r); + h.OnJudgementRemoved += (d, r) => OnJudgementRemoved?.Invoke(d, r); h.ApplyCustomUpdateState += (d, j) => ApplyCustomUpdateState?.Invoke(d, j); nestedHitObjects.Value.Add(h); @@ -172,18 +178,21 @@ namespace osu.Game.Rulesets.Objects.Drawables /// Notifies that a new judgement has occurred for this . /// /// The . - protected void ApplyJudgement(T judgement, Action application) - where T : Judgement + protected void ApplyResult(JudgementResult result, Action application) { - judgementOccurred = true; + // Todo: Unsure if we want to keep this + if (!Results.Contains(result)) + throw new ArgumentException($"The applied judgement result must be a part of {Results}."); - application?.Invoke(judgement); + application?.Invoke(result); + + judgementOccurred = true; // Ensure that the judgement is given a valid time offset, because this may not get set by the caller var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; - judgement.TimeOffset = Time.Current - endTime; + result.TimeOffset = Time.Current - endTime; - switch (judgement.Result) + switch (result.Type) { case HitResult.None: break; @@ -195,7 +204,7 @@ namespace osu.Game.Rulesets.Objects.Drawables break; } - OnJudgement?.Invoke(this, judgement); + OnJudgement?.Invoke(this, result); } /// @@ -224,7 +233,7 @@ namespace osu.Game.Rulesets.Objects.Drawables /// /// Checks if any judgements have occurred for this . This method must construct - /// all s and notify of them through . + /// all s and notify of them through . /// /// Whether the user triggered this check. /// The offset from the end time at which this check occurred. A > 0 @@ -232,6 +241,8 @@ namespace osu.Game.Rulesets.Objects.Drawables protected virtual void CheckForJudgements(bool userTriggered, double timeOffset) { } + + protected virtual JudgementResult CreateJudgementResult(Judgement judgement) => new JudgementResult(judgement); } public abstract class DrawableHitObject : DrawableHitObject diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index fa8c11df7f..ccd3fb6e69 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Scoring /// /// Invoked when a new judgement has occurred. This occurs after the judgement has been processed by the . /// - public event Action NewJudgement; + public event Action NewJudgement; /// /// Additional conditions on top of that cause a failing state. @@ -144,9 +144,10 @@ namespace osu.Game.Rulesets.Scoring /// Notifies subscribers of that a new judgement has occurred. /// /// The judgement to notify subscribers of. - protected void NotifyNewJudgement(Judgement judgement) + /// The judgement scoring result to notify subscribers of. + protected void NotifyNewJudgement(JudgementResult result) { - NewJudgement?.Invoke(judgement); + NewJudgement?.Invoke(result); if (HasCompleted) AllJudged?.Invoke(); @@ -209,32 +210,47 @@ namespace osu.Game.Rulesets.Scoring Mode.ValueChanged += _ => updateScore(); } - /// - /// Simulates an autoplay of s that will be judged by this - /// by adding s for each in the . - /// - /// This is required for to work, otherwise will be used. - /// - /// - /// The containing the s that will be judged by this . - protected virtual void SimulateAutoplay(Beatmap beatmap) { } + protected virtual void ApplyBeatmap(Beatmap beatmap) + { + } + + protected virtual void SimulateAutoplay(Beatmap beatmap) + { + foreach (var obj in beatmap.HitObjects) + simulate(obj); + + void simulate(HitObject obj) + { + foreach (var nested in obj.NestedHitObjects) + simulate(nested); + + foreach (var judgement in obj.Judgements) + AddJudgement(new JudgementResult(judgement) { Type = judgement.MaxResult }); + } + } /// /// Adds a judgement to this ScoreProcessor. /// /// The judgement to add. - protected void AddJudgement(Judgement judgement) + /// The judgement scoring result. + protected void AddJudgement(JudgementResult result) { - OnNewJudgement(judgement); + OnNewJudgement(result); updateScore(); UpdateFailed(); - NotifyNewJudgement(judgement); + NotifyNewJudgement(result); } - protected void RemoveJudgement(Judgement judgement) + /// + /// Removes a judgement from this ScoreProcessor. + /// + /// The judgement to remove. + /// The judgement scoring result. + protected void RemoveJudgement(JudgementResult result) { - OnJudgementRemoved(judgement); + OnJudgementRemoved(result); updateScore(); } @@ -242,16 +258,17 @@ namespace osu.Game.Rulesets.Scoring /// Applies a judgement. /// /// The judgement to apply/ - protected virtual void OnNewJudgement(Judgement judgement) + /// The judgement scoring result. + protected virtual void OnNewJudgement(JudgementResult result) { - judgement.ComboAtJudgement = Combo; - judgement.HighestComboAtJudgement = HighestCombo; + result.ComboAtJudgement = Combo; + result.HighestComboAtJudgement = HighestCombo; JudgedHits++; - if (judgement.AffectsCombo) + if (result.Judgement.AffectsCombo) { - switch (judgement.Result) + switch (result.Type) { case HitResult.None: break; @@ -264,15 +281,15 @@ namespace osu.Game.Rulesets.Scoring } } - if (judgement.IsBonus) + if (result.Judgement.IsBonus) { - if (judgement.IsHit) - bonusScore += judgement.NumericResult; + if (result.IsHit) + bonusScore += result.Judgement.NumericResultFor(result); } else { - baseScore += judgement.NumericResult; - rollingMaxBaseScore += judgement.MaxNumericResult; + baseScore += result.Judgement.NumericResultFor(result); + rollingMaxBaseScore += result.Judgement.MaxNumericResult; } } @@ -280,22 +297,23 @@ namespace osu.Game.Rulesets.Scoring /// Removes a judgement. This should reverse everything in . /// /// The judgement to remove. - protected virtual void OnJudgementRemoved(Judgement judgement) + /// The judgement scoring result. + protected virtual void OnJudgementRemoved(JudgementResult result) { - Combo.Value = judgement.ComboAtJudgement; - HighestCombo.Value = judgement.HighestComboAtJudgement; + Combo.Value = result.ComboAtJudgement; + HighestCombo.Value = result.HighestComboAtJudgement; JudgedHits--; - if (judgement.IsBonus) + if (result.Judgement.IsBonus) { - if (judgement.IsHit) - bonusScore -= judgement.NumericResult; + if (result.IsHit) + bonusScore -= result.Judgement.NumericResultFor(result); } else { - baseScore -= judgement.NumericResult; - rollingMaxBaseScore -= judgement.MaxNumericResult; + baseScore -= result.Judgement.NumericResultFor(result); + rollingMaxBaseScore -= result.Judgement.MaxNumericResult; } } diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index ee34e2df04..e890cccc3c 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -182,8 +182,8 @@ namespace osu.Game.Rulesets.UI public abstract class RulesetContainer : RulesetContainer where TObject : HitObject { - public event Action OnJudgement; - public event Action OnJudgementRemoved; + public event Action OnJudgement; + public event Action OnJudgementRemoved; /// /// The Beatmap @@ -290,8 +290,8 @@ namespace osu.Game.Rulesets.UI if (drawableObject == null) continue; - drawableObject.OnJudgement += (d, j) => OnJudgement?.Invoke(j); - drawableObject.OnJudgementRemoved += (d, j) => OnJudgementRemoved?.Invoke(j); + drawableObject.OnJudgement += (_, r) => OnJudgement?.Invoke(r); + drawableObject.OnJudgementRemoved += (_, r) => OnJudgementRemoved?.Invoke(r); Playfield.Add(drawableObject); } diff --git a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs index ab446550a6..b551b1f7a6 100644 --- a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs @@ -92,9 +92,9 @@ namespace osu.Game.Screens.Play.HUD }; } - public void Flash(Judgement judgement) + public void Flash(JudgementResult result) { - if (judgement.Result == HitResult.Miss) + if (result.Type == HitResult.Miss) return; fill.FadeEdgeEffectTo(Math.Min(1, fill.EdgeEffect.Colour.Linear.A + (1f - base_glow_opacity) / glow_max_hits), 50, Easing.OutQuint) From 9c2122c0ca30650d364f384b3b95200cea4d5d74 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 2 Aug 2018 20:36:08 +0900 Subject: [PATCH 248/304] Make Rulesets.Taiko use the new judgement result structure --- .../TestCaseTaikoPlayfield.cs | 9 ++-- .../TaikoIntermediateSwellJudgement.cs | 2 +- .../Objects/Drawables/DrawableDrumRoll.cs | 19 +++++--- .../Objects/Drawables/DrawableDrumRollTick.cs | 17 +++++-- .../Objects/Drawables/DrawableHit.cs | 14 ++++-- .../Objects/Drawables/DrawableHitStrong.cs | 17 ++++--- .../Objects/Drawables/DrawableSwell.cs | 25 +++++++--- osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs | 7 +-- osu.Game.Rulesets.Taiko/Objects/Hit.cs | 7 +-- osu.Game.Rulesets.Taiko/Objects/Swell.cs | 14 +----- .../Scoring/TaikoScoreProcessor.cs | 47 +++---------------- .../UI/DrawableTaikoJudgement.cs | 10 ++-- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 14 +++--- 13 files changed, 96 insertions(+), 106 deletions(-) diff --git a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs index 1bf24a46bc..ccae3cf3ce 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs @@ -11,6 +11,7 @@ using osu.Framework.MathUtils; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Taiko.Judgements; @@ -143,18 +144,18 @@ namespace osu.Game.Rulesets.Taiko.Tests var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) }; - ((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new TaikoJudgement { Result = hitResult }); + ((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult }); if (RNG.Next(10) == 0) { - ((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new TaikoJudgement { Result = hitResult }); - ((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new TaikoStrongHitJudgement()); + ((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult }); + ((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new JudgementResult(new TaikoStrongHitJudgement()) { Type = HitResult.Great }); } } private void addMissJudgement() { - ((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(new DrawableTestHit(new Hit()), new TaikoJudgement { Result = HitResult.Miss }); + ((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(new DrawableTestHit(new Hit()), new JudgementResult(new TaikoJudgement()) { Type = HitResult.Miss }); } private void addBarLine(bool major, double delay = scroll_time) diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoIntermediateSwellJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoIntermediateSwellJudgement.cs index adcf4572c5..81a1bd1344 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoIntermediateSwellJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoIntermediateSwellJudgement.cs @@ -7,7 +7,7 @@ namespace osu.Game.Rulesets.Taiko.Judgements { public class TaikoIntermediateSwellJudgement : TaikoJudgement { - public override HitResult MaxResult => HitResult.Perfect; + public override HitResult MaxResult => HitResult.Great; public override bool AffectsCombo => false; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs index 57c0f55a59..93eaeb4a1f 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.Taiko.Judgements; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { @@ -23,6 +24,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables /// private const int rolling_hits_for_engaged_colour = 5; + private readonly JudgementResult result; + private readonly JudgementResult strongResult; + /// /// Rolling number of tick hits. This increases for hits and decreases for misses. /// @@ -44,6 +48,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables AddNested(newTick); tickContainer.Add(newTick); } + + result = Results.Single(r => !(r.Judgement is TaikoStrongHitJudgement)); + strongResult = Results.SingleOrDefault(r => r.Judgement is TaikoStrongHitJudgement); } protected override TaikoPiece CreateMainPiece() => new ElongatedCirclePiece(); @@ -60,9 +67,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables colourEngaged = colours.YellowDarker; } - private void onTickJudgement(DrawableHitObject obj, Judgement judgement) + private void onTickJudgement(DrawableHitObject obj, JudgementResult result) { - if (judgement.Result > HitResult.Miss) + if (result.Type > HitResult.Miss) rollingHits++; else rollingHits--; @@ -84,15 +91,15 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables int countHit = NestedHitObjects.Count(o => o.IsHit); if (countHit >= HitObject.RequiredGoodHits) { - ApplyJudgement(HitObject.Judgement, j => j.Result = countHit >= HitObject.RequiredGreatHits ? HitResult.Great : HitResult.Good); + ApplyResult(result, r => r.Type = countHit >= HitObject.RequiredGreatHits ? HitResult.Great : HitResult.Good); if (HitObject.IsStrong) - ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Great); + ApplyResult(strongResult, r => r.Type = HitResult.Great); } else { - ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss); + ApplyResult(result, r => r.Type = HitResult.Miss); if (HitObject.IsStrong) - ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Miss); + ApplyResult(strongResult, r => r.Type = HitResult.Miss); } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs index 86853afc35..eeca1b1da3 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs @@ -2,19 +2,28 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Linq; using osu.Framework.Graphics; +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableDrumRollTick : DrawableTaikoHitObject { + private readonly JudgementResult result; + private readonly JudgementResult strongResult; + public DrawableDrumRollTick(DrumRollTick tick) : base(tick) { FillMode = FillMode.Fit; + + result = Results.Single(r => !(r.Judgement is TaikoStrongHitJudgement)); + strongResult = Results.SingleOrDefault(r => r.Judgement is TaikoStrongHitJudgement); } public override bool DisplayJudgement => false; @@ -30,9 +39,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { if (timeOffset > HitObject.HitWindow) { - ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss); + ApplyResult(result, r => r.Type = HitResult.Miss); if (HitObject.IsStrong) - ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Miss); + ApplyResult(strongResult, r => r.Type = HitResult.Miss); } return; @@ -41,9 +50,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables if (Math.Abs(timeOffset) > HitObject.HitWindow) return; - ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Great); + ApplyResult(result, r => r.Type = HitResult.Great); if (HitObject.IsStrong) - ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Great); + ApplyResult(strongResult, r => r.Type = HitResult.Great); } protected override void UpdateState(ArmedState state) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index f7a170d838..18177ad089 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -3,8 +3,10 @@ using System.Linq; using osu.Framework.Graphics; +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Taiko.Objects.Drawables @@ -16,6 +18,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables /// protected abstract TaikoAction[] HitActions { get; } + protected readonly JudgementResult Result; + /// /// Whether the last key pressed is a valid hit key. /// @@ -25,6 +29,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables : base(hit) { FillMode = FillMode.Fit; + + Result = Results.Single(r => !(r.Judgement is TaikoStrongHitJudgement)); } protected override void CheckForJudgements(bool userTriggered, double timeOffset) @@ -32,7 +38,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables if (!userTriggered) { if (!HitObject.HitWindows.CanBeHit(timeOffset)) - ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss); + ApplyResult(Result, r => r.Type = HitResult.Miss); return; } @@ -40,10 +46,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables if (result == HitResult.None) return; - if (!validKeyPressed || result == HitResult.Miss) - ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss); + if (!validKeyPressed) + ApplyResult(Result, r => r.Type = HitResult.Miss); else - ApplyJudgement(HitObject.Judgement, j => j.Result = result); + ApplyResult(Result, r => r.Type = result); } public override bool OnPressed(TaikoAction action) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs index ede13aadce..7ec0c08f0f 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs @@ -3,8 +3,10 @@ using System; using System.Linq; +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.Taiko.Judgements; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { @@ -16,6 +18,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables /// private const double second_hit_window = 30; + private readonly JudgementResult strongResult; + private double firstHitTime; private bool firstKeyHeld; private TaikoAction firstHitAction; @@ -23,31 +27,32 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected DrawableHitStrong(Hit hit) : base(hit) { + strongResult = Results.SingleOrDefault(r => r.Judgement is TaikoStrongHitJudgement); } protected override void CheckForJudgements(bool userTriggered, double timeOffset) { - if (!HitObject.Judgement.HasResult) + if (!Result.HasResult) { base.CheckForJudgements(userTriggered, timeOffset); return; } - if (!HitObject.Judgement.IsHit) + if (!Result.IsHit) { - ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Miss); + ApplyResult(strongResult, r => r.Type = HitResult.Miss); return; } if (!userTriggered) { if (timeOffset > second_hit_window) - ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Miss); + ApplyResult(strongResult, r => r.Type = HitResult.Miss); return; } if (Math.Abs(firstHitTime - Time.Current) < second_hit_window) - ApplyJudgement(HitObject.StrongJudgement, j => j.Result = HitResult.Great); + ApplyResult(strongResult, r => r.Type = HitResult.Great); } protected override void UpdateState(ArmedState state) @@ -76,7 +81,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables return false; // Check if we've handled the first key - if (!HitObject.Judgement.HasResult) + if (!Result.HasResult) { // First key hasn't been handled yet, attempt to handle it bool handled = base.OnPressed(action); diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index f44e70d11d..50b010e543 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; @@ -13,7 +14,9 @@ using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.Taiko.Judgements; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { @@ -29,6 +32,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private const float target_ring_scale = 5f; private const float inner_ring_alpha = 0.65f; + private readonly JudgementResult result; + private readonly List intermediateResults; + private readonly Container bodyContainer; private readonly CircularContainer targetRing; private readonly CircularContainer expandingRing; @@ -106,6 +112,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables }); MainPiece.Add(symbol = new SwellSymbolPiece()); + + result = Results.Single(r => !(r.Judgement is TaikoIntermediateSwellJudgement)); + intermediateResults = Results.Where(r => r.Judgement is TaikoIntermediateSwellJudgement).ToList(); } [BackgroundDependencyLoader] @@ -128,12 +137,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { if (userTriggered) { - var nextIntermediate = HitObject.IntermediateJudgements.FirstOrDefault(j => !j.HasResult); + var nextIntermediate = intermediateResults.FirstOrDefault(j => !j.HasResult); if (nextIntermediate != null) - ApplyJudgement(nextIntermediate, j => j.Result = HitResult.Great); + ApplyResult(nextIntermediate, r => r.Type = HitResult.Great); - var numHits = HitObject.IntermediateJudgements.Count(j => j.HasResult); + var numHits = intermediateResults.Count(r => r.HasResult); var completion = (float)numHits / HitObject.RequiredHits; @@ -147,7 +156,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables expandingRing.ScaleTo(1f + Math.Min(target_ring_scale - 1f, (target_ring_scale - 1f) * completion * 1.3f), 260, Easing.OutQuint); if (numHits == HitObject.RequiredHits) - ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Great); + ApplyResult(result, r => r.Type = HitResult.Great); } else { @@ -156,7 +165,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables int numHits = 0; - foreach (var intermediate in HitObject.IntermediateJudgements) + foreach (var intermediate in intermediateResults) { if (intermediate.HasResult) { @@ -164,10 +173,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables continue; } - ApplyJudgement(intermediate, j => j.Result = HitResult.Miss); + ApplyResult(intermediate, r => r.Type = HitResult.Miss); } - ApplyJudgement(HitObject.Judgement, j => j.Result = numHits > HitObject.RequiredHits / 2 ? HitResult.Good : HitResult.Miss); + var hitResult = numHits > HitObject.RequiredHits / 2 ? HitResult.Good : HitResult.Miss; + + ApplyResult(result, r => r.Type = hitResult); } } diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs index b6b1efee16..2ed59d3c43 100644 --- a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs @@ -85,15 +85,12 @@ namespace osu.Game.Rulesets.Taiko.Objects } } - public TaikoJudgement Judgement { get; private set; } - public TaikoStrongHitJudgement StrongJudgement { get; private set; } - protected override IEnumerable CreateJudgements() { - yield return Judgement = new TaikoJudgement(); + yield return new TaikoJudgement(); if (IsStrong) - yield return StrongJudgement = new TaikoStrongHitJudgement(); + yield return new TaikoStrongHitJudgement(); } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Hit.cs b/osu.Game.Rulesets.Taiko/Objects/Hit.cs index 94fc1ab20f..6795aef730 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Hit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Hit.cs @@ -9,15 +9,12 @@ namespace osu.Game.Rulesets.Taiko.Objects { public class Hit : TaikoHitObject { - public TaikoJudgement Judgement { get; private set; } - public TaikoStrongHitJudgement StrongJudgement { get; private set; } - protected override IEnumerable CreateJudgements() { - yield return Judgement = new TaikoJudgement(); + yield return new TaikoJudgement(); if (IsStrong) - yield return StrongJudgement = new TaikoStrongHitJudgement(); + yield return new TaikoStrongHitJudgement(); } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs index 0985853dd6..2dec6019eb 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Swell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs @@ -19,22 +19,12 @@ namespace osu.Game.Rulesets.Taiko.Objects /// public int RequiredHits = 10; - public TaikoJudgement Judgement { get; private set; } - - private readonly List intermediateJudgements = new List(); - public IReadOnlyList IntermediateJudgements => intermediateJudgements; - protected override IEnumerable CreateJudgements() { - yield return Judgement = new TaikoJudgement(); + yield return new TaikoJudgement(); for (int i = 0; i < RequiredHits; i++) - { - var intermediate = new TaikoIntermediateSwellJudgement(); - intermediateJudgements.Add(intermediate); - - yield return intermediate; - } + yield return new TaikoIntermediateSwellJudgement(); } } } diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index 7dd50ab8b8..f5c5fcbe9c 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.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.Linq; using osu.Game.Beatmaps; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; @@ -60,63 +59,31 @@ namespace osu.Game.Rulesets.Taiko.Scoring private double hpIncreaseGood; private double hpIncreaseMiss; - public TaikoScoreProcessor() - { - } - public TaikoScoreProcessor(RulesetContainer rulesetContainer) : base(rulesetContainer) { } - protected override void SimulateAutoplay(Beatmap beatmap) + protected override void ApplyBeatmap(Beatmap beatmap) { + base.ApplyBeatmap(beatmap); + double hpMultiplierNormal = 1 / (hp_hit_great * beatmap.HitObjects.FindAll(o => o is Hit).Count * BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, 0.5, 0.75, 0.98)); hpIncreaseTick = hp_hit_tick; hpIncreaseGreat = hpMultiplierNormal * hp_hit_great; hpIncreaseGood = hpMultiplierNormal * hp_hit_good; hpIncreaseMiss = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, hp_miss_min, hp_miss_mid, hp_miss_max); - - foreach (var obj in beatmap.HitObjects) - { - switch (obj) - { - case Hit _: - AddJudgement(new TaikoJudgement { Result = HitResult.Great }); - if (obj.IsStrong) - AddJudgement(new TaikoStrongHitJudgement()); - break; - case DrumRoll drumRoll: - var count = drumRoll.NestedHitObjects.OfType().Count(); - for (int i = 0; i < count; i++) - { - AddJudgement(new TaikoDrumRollTickJudgement { Result = HitResult.Great }); - - if (obj.IsStrong) - AddJudgement(new TaikoStrongHitJudgement()); - } - - AddJudgement(new TaikoJudgement { Result = HitResult.Great }); - - if (obj.IsStrong) - AddJudgement(new TaikoStrongHitJudgement()); - break; - case Swell _: - AddJudgement(new TaikoJudgement { Result = HitResult.Great }); - break; - } - } } - protected override void OnNewJudgement(Judgement judgement) + protected override void OnNewJudgement(JudgementResult result) { - base.OnNewJudgement(judgement); + base.OnNewJudgement(result); - bool isTick = judgement is TaikoDrumRollTickJudgement; + bool isTick = result.Judgement is TaikoDrumRollTickJudgement; // Apply HP changes - switch (judgement.Result) + switch (result.Type) { case HitResult.Miss: // Missing ticks shouldn't drop HP diff --git a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs index b07a3ce8df..4d660918b8 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs @@ -19,16 +19,16 @@ namespace osu.Game.Rulesets.Taiko.UI /// Creates a new judgement text. /// /// The object which is being judged. - /// The judgement to visualise. - public DrawableTaikoJudgement(Judgement judgement, DrawableHitObject judgedObject) - : base(judgement, judgedObject) + /// The judgement to visualise. + public DrawableTaikoJudgement(JudgementResult result, DrawableHitObject judgedObject) + : base(result, judgedObject) { } [BackgroundDependencyLoader] private void load(OsuColour colours) { - switch (Judgement.Result) + switch (Result.Type) { case HitResult.Good: Colour = colours.GreenLight; @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Taiko.UI protected override void LoadComplete() { - if (Judgement.IsHit) + if (Result.IsHit) this.MoveToY(-100, 500); base.LoadComplete(); diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 4cb8dd48a7..40198a701a 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -224,28 +224,28 @@ namespace osu.Game.Rulesets.Taiko.UI } } - internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) + internal void OnJudgement(DrawableHitObject judgedObject, JudgementResult result) { if (!DisplayJudgements) return; if (judgedObject.DisplayJudgement && judgementContainer.FirstOrDefault(j => j.JudgedObject == judgedObject) == null) { - judgementContainer.Add(new DrawableTaikoJudgement(judgement, judgedObject) + judgementContainer.Add(new DrawableTaikoJudgement(result, judgedObject) { - Anchor = judgement.IsHit ? Anchor.TopLeft : Anchor.CentreLeft, - Origin = judgement.IsHit ? Anchor.BottomCentre : Anchor.Centre, + Anchor = result.IsHit ? Anchor.TopLeft : Anchor.CentreLeft, + Origin = result.IsHit ? Anchor.BottomCentre : Anchor.Centre, RelativePositionAxes = Axes.X, - X = judgement.IsHit ? judgedObject.Position.X : 0, + X = result.IsHit ? judgedObject.Position.X : 0, }); } - if (!judgement.IsHit) + if (!result.IsHit) return; bool isRim = judgedObject.HitObject is RimHit; - if (judgement is TaikoStrongHitJudgement) + if (result.Judgement is TaikoStrongHitJudgement) hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == judgedObject)?.VisualiseSecondHit(); else { From 4548d2c87f72dfe0542d45d0f64f112f9ee86f1f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 2 Aug 2018 20:36:38 +0900 Subject: [PATCH 249/304] Make Rulesets.Osu use the new judgement result structure --- .../TestCaseHitCircle.cs | 2 +- osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs | 6 +-- .../Judgements/ComboResult.cs | 17 ++++++++ .../Judgements/OsuJudgement.cs | 3 -- .../Judgements/OsuJudgementResult.cs | 17 ++++++++ .../Objects/Drawables/DrawableHitCircle.cs | 5 ++- .../Objects/Drawables/DrawableOsuHitObject.cs | 24 ++++++------ .../Objects/Drawables/DrawableOsuJudgement.cs | 6 +-- .../Objects/Drawables/DrawableRepeatPoint.cs | 3 +- .../Objects/Drawables/DrawableSlider.cs | 14 +++---- .../Objects/Drawables/DrawableSliderTail.cs | 3 +- .../Objects/Drawables/DrawableSliderTick.cs | 3 +- .../Objects/Drawables/DrawableSpinner.cs | 10 ++--- osu.Game.Rulesets.Osu/Objects/HitCircle.cs | 5 +++ osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 9 ----- osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs | 5 +++ osu.Game.Rulesets.Osu/Objects/Slider.cs | 4 ++ .../Objects/SliderTailCircle.cs | 4 +- osu.Game.Rulesets.Osu/Objects/SliderTick.cs | 5 +++ osu.Game.Rulesets.Osu/Objects/Spinner.cs | 5 +++ .../Scoring/OsuScoreProcessor.cs | 39 +++++-------------- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 4 +- 22 files changed, 112 insertions(+), 81 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Judgements/ComboResult.cs create mode 100644 osu.Game.Rulesets.Osu/Judgements/OsuJudgementResult.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs index eea5aa9a52..e44016e48b 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs @@ -99,7 +99,7 @@ namespace osu.Game.Rulesets.Osu.Tests if (auto && !userTriggered && timeOffset > 0) { // force success - ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Great); + ApplyResult(Results.Single(), r => r.Type = HitResult.Great); } else base.CheckForJudgements(userTriggered, timeOffset); diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs index cb1ea5cc5f..2da4d8265d 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs @@ -310,7 +310,7 @@ namespace osu.Game.Rulesets.Osu.Tests } private float judgementOffsetDirection = 1; - private void onJudgement(DrawableHitObject judgedObject, Judgement judgement) + private void onJudgement(DrawableHitObject judgedObject, JudgementResult result) { var osuObject = judgedObject as DrawableOsuHitObject; if (osuObject == null) @@ -321,8 +321,8 @@ namespace osu.Game.Rulesets.Osu.Tests { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Text = judgement.IsHit ? "Hit!" : "Miss!", - Colour = judgement.IsHit ? Color4.Green : Color4.Red, + Text = result.IsHit ? "Hit!" : "Miss!", + Colour = result.IsHit ? Color4.Green : Color4.Red, TextSize = 30, Position = osuObject.HitObject.StackedEndPosition + judgementOffsetDirection * new Vector2(0, 45) }); diff --git a/osu.Game.Rulesets.Osu/Judgements/ComboResult.cs b/osu.Game.Rulesets.Osu/Judgements/ComboResult.cs new file mode 100644 index 0000000000..3000031c78 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Judgements/ComboResult.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.ComponentModel; + +namespace osu.Game.Rulesets.Osu.Judgements +{ + public enum ComboResult + { + [Description(@"")] + None, + [Description(@"Good")] + Good, + [Description(@"Amazing")] + Perfect + } +} diff --git a/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs b/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs index 26becfdec9..b1c9760866 100644 --- a/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs +++ b/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Judgements @@ -25,7 +24,5 @@ namespace osu.Game.Rulesets.Osu.Judgements return 300; } } - - public ComboResult Combo; } } diff --git a/osu.Game.Rulesets.Osu/Judgements/OsuJudgementResult.cs b/osu.Game.Rulesets.Osu/Judgements/OsuJudgementResult.cs new file mode 100644 index 0000000000..17b8b4399f --- /dev/null +++ b/osu.Game.Rulesets.Osu/Judgements/OsuJudgementResult.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Judgements; + +namespace osu.Game.Rulesets.Osu.Judgements +{ + public class OsuJudgementResult : JudgementResult + { + public ComboResult ComboType; + + public OsuJudgementResult(Judgement judgement) + : base(judgement) + { + } + } +} diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 7fd4d11455..a09748e450 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Linq; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; @@ -81,7 +82,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables if (!userTriggered) { if (!HitObject.HitWindows.CanBeHit(timeOffset)) - ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss); + ApplyResult(Results.Single(), r => r.Type = HitResult.Miss); return; } @@ -90,7 +91,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables if (result == HitResult.None) return; - ApplyJudgement(HitObject.Judgement, j => j.Result = result); + ApplyResult(Results.Single(), r => r.Type = result); } protected override void UpdatePreemptState() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 6e24f1bc83..187cbc29a2 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -2,11 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.ComponentModel; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Graphics; using System.Linq; +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; using OpenTK.Graphics; @@ -34,7 +35,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { UpdatePreemptState(); - var judgementOffset = Math.Min(HitObject.HitWindows.HalfWindowFor(HitResult.Miss), HitObject.Judgements.FirstOrDefault()?.TimeOffset ?? 0); + var judgementOffset = Math.Min(HitObject.HitWindows.HalfWindowFor(HitResult.Miss), Results.FirstOrDefault()?.TimeOffset ?? 0); using (BeginDelayedSequence(HitObject.TimePreempt + judgementOffset, true)) UpdateCurrentState(state); @@ -57,20 +58,17 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables // Todo: At some point we need to move these to DrawableHitObject after ensuring that all other Rulesets apply // transforms in the same way and don't rely on them not being cleared - public override void ClearTransformsAfter(double time, bool propagateChildren = false, string targetMember = null) { } - public override void ApplyTransformsAt(double time, bool propagateChildren = false) { } + public override void ClearTransformsAfter(double time, bool propagateChildren = false, string targetMember = null) + { + } + + public override void ApplyTransformsAt(double time, bool propagateChildren = false) + { + } private OsuInputManager osuActionInputManager; internal OsuInputManager OsuActionInputManager => osuActionInputManager ?? (osuActionInputManager = GetContainingInputManager() as OsuInputManager); - } - public enum ComboResult - { - [Description(@"")] - None, - [Description(@"Good")] - Good, - [Description(@"Amazing")] - Perfect + protected override JudgementResult CreateJudgementResult(Judgement judgement) => new OsuJudgementResult(judgement); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs index e8743281da..04ec3f13c7 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs @@ -11,14 +11,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableOsuJudgement : DrawableJudgement { - public DrawableOsuJudgement(Judgement judgement, DrawableHitObject judgedObject) - : base(judgement, judgedObject) + public DrawableOsuJudgement(JudgementResult result, DrawableHitObject judgedObject) + : base(result, judgedObject) { } protected override void LoadComplete() { - if (Judgement.Result != HitResult.Miss) + if (Result.Type != HitResult.Miss) JudgementText?.TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint); base.LoadComplete(); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index 809b27e065..7ef56f07e2 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using osu.Framework.Graphics; using osu.Framework.MathUtils; using osu.Game.Rulesets.Objects.Drawables; @@ -44,7 +45,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (repeatPoint.StartTime <= Time.Current) - ApplyJudgement(HitObject.Judgement, j => j.Result = drawableSlider.Tracking ? HitResult.Great : HitResult.Miss); + ApplyResult(Results.Single(), r => r.Type = drawableSlider.Tracking ? HitResult.Great : HitResult.Miss); } protected override void UpdatePreemptState() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 6739c3a822..fc6510471b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -136,21 +136,21 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables if (userTriggered || Time.Current < slider.EndTime) return; - ApplyJudgement(HitObject.Judgement, j => + ApplyResult(Results.Single(), r => { var judgementsCount = NestedHitObjects.Count(); var judgementsHit = NestedHitObjects.Count(h => h.IsHit); var hitFraction = (double)judgementsHit / judgementsCount; - if (hitFraction == 1 && HeadCircle.HitObject.Judgement.Result == HitResult.Great) - j.Result = HitResult.Great; - else if (hitFraction >= 0.5 && HeadCircle.HitObject.Judgement.Result >= HitResult.Good) - j.Result = HitResult.Good; + if (hitFraction == 1 && HeadCircle.Results.Single().Type == HitResult.Great) + r.Type = HitResult.Great; + else if (hitFraction >= 0.5 && HeadCircle.Results.Single().Type >= HitResult.Good) + r.Type = HitResult.Good; else if (hitFraction > 0) - j.Result = HitResult.Meh; + r.Type = HitResult.Meh; else - j.Result = HitResult.Miss; + r.Type = HitResult.Miss; }); } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs index 64c4a8ef18..7cbb7db6d4 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.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.Linq; using osu.Framework.Graphics; using osu.Game.Rulesets.Scoring; @@ -31,7 +32,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (!userTriggered && timeOffset >= 0) - ApplyJudgement(HitObject.Judgement, j => j.Result = Tracking ? HitResult.Great : HitResult.Miss); + ApplyResult(Results.Single(), r => r.Type = Tracking ? HitResult.Great : HitResult.Miss); } } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index f7b403a5cc..c4c853cb58 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.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.Linq; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; @@ -50,7 +51,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (timeOffset >= 0) - ApplyJudgement(HitObject.Judgement, j => j.Result = Tracking ? HitResult.Great : HitResult.Miss); + ApplyResult(Results.Single(), r => r.Type = Tracking ? HitResult.Great : HitResult.Miss); } protected override void UpdatePreemptState() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 4a0303f00f..4db928c578 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -138,16 +138,16 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables if (userTriggered || Time.Current < Spinner.EndTime) return; - ApplyJudgement(HitObject.Judgement, j => + ApplyResult(Results.Single(), r => { if (Progress >= 1) - j.Result = HitResult.Great; + r.Type = HitResult.Great; else if (Progress > .9) - j.Result = HitResult.Good; + r.Type = HitResult.Good; else if (Progress > .75) - j.Result = HitResult.Meh; + r.Type = HitResult.Meh; else if (Time.Current >= Spinner.EndTime) - j.Result = HitResult.Miss; + r.Type = HitResult.Miss; }); } diff --git a/osu.Game.Rulesets.Osu/Objects/HitCircle.cs b/osu.Game.Rulesets.Osu/Objects/HitCircle.cs index 9e309a376d..2514988e9f 100644 --- a/osu.Game.Rulesets.Osu/Objects/HitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/HitCircle.cs @@ -1,9 +1,14 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Osu.Judgements; + namespace osu.Game.Rulesets.Osu.Objects { public class HitCircle : OsuHitObject { + protected override IEnumerable CreateJudgements() => new[] { new OsuJudgement() }; } } diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index 3927ed02d5..48a6365c00 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -2,15 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; using OpenTK; using osu.Game.Rulesets.Objects.Types; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Edit.Types; -using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Osu.Judgements; namespace osu.Game.Rulesets.Osu.Objects { @@ -76,11 +73,5 @@ namespace osu.Game.Rulesets.Osu.Objects public virtual void OffsetPosition(Vector2 offset) => Position += offset; protected override HitWindows CreateHitWindows() => new OsuHitWindows(); - - public OsuJudgement Judgement { get; private set; } - - protected override IEnumerable CreateJudgements() => new[] { Judgement = CreateJudgement() }; - - protected virtual OsuJudgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs index 3495bc1b4b..ef794eafdb 100644 --- a/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs @@ -2,8 +2,11 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Osu.Judgements; namespace osu.Game.Rulesets.Osu.Objects { @@ -24,5 +27,7 @@ namespace osu.Game.Rulesets.Osu.Objects if (RepeatIndex > 0) TimePreempt = Math.Min(SpanDuration * 2, TimePreempt); } + + protected override IEnumerable CreateJudgements() => new[] { new OsuJudgement() }; } } diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 972dd42fd6..54899fb9f5 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -10,6 +10,8 @@ using System.Linq; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Osu.Judgements; namespace osu.Game.Rulesets.Osu.Objects { @@ -211,5 +213,7 @@ namespace osu.Game.Rulesets.Osu.Objects }); } } + + protected override IEnumerable CreateJudgements() => new[] { new OsuJudgement() }; } } diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs index 3fae9e9f8a..93c8d94920 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.Judgements; namespace osu.Game.Rulesets.Osu.Objects @@ -12,6 +14,6 @@ namespace osu.Game.Rulesets.Osu.Objects { } - protected override OsuJudgement CreateJudgement() => new OsuSliderTailJudgement(); + protected override IEnumerable CreateJudgements() => new[] { new OsuSliderTailJudgement() }; } } diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs index 54337a12be..24ab812649 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs @@ -1,8 +1,11 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Osu.Judgements; namespace osu.Game.Rulesets.Osu.Objects { @@ -26,5 +29,7 @@ namespace osu.Game.Rulesets.Osu.Objects TimePreempt = (StartTime - SpanStartTime) / 2 + offset; } + + protected override IEnumerable CreateJudgements() => new[] { new OsuJudgement() }; } } diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index 503ad85674..f7bb806503 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -2,9 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects.Types; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Osu.Judgements; namespace osu.Game.Rulesets.Osu.Objects { @@ -29,5 +32,7 @@ namespace osu.Game.Rulesets.Osu.Objects // spinning doesn't match 1:1 with stable, so let's fudge them easier for the time being. SpinsRequired = (int)Math.Max(1, SpinsRequired * 0.6); } + + protected override IEnumerable CreateJudgements() => new[] { new OsuJudgement() }; } } diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index 01b92255ae..a8f656bc6b 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -2,13 +2,11 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.Linq; using osu.Framework.Extensions; using osu.Game.Beatmaps; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Osu.Objects; -using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; @@ -26,28 +24,11 @@ namespace osu.Game.Rulesets.Osu.Scoring private readonly Dictionary scoreResultCounts = new Dictionary(); private readonly Dictionary comboResultCounts = new Dictionary(); - protected override void SimulateAutoplay(Beatmap beatmap) + protected override void ApplyBeatmap(Beatmap beatmap) { + base.ApplyBeatmap(beatmap); + hpDrainRate = beatmap.BeatmapInfo.BaseDifficulty.DrainRate; - - foreach (var obj in beatmap.HitObjects) - { - if (obj is Slider slider) - { - // Head - AddJudgement(new OsuJudgement { Result = HitResult.Great }); - - // Ticks - foreach (var unused in slider.NestedHitObjects.OfType()) - AddJudgement(new OsuJudgement { Result = HitResult.Great }); - - //Repeats - foreach (var unused in slider.NestedHitObjects.OfType()) - AddJudgement(new OsuJudgement { Result = HitResult.Great }); - } - - AddJudgement(new OsuJudgement { Result = HitResult.Great }); - } } protected override void Reset(bool storeResults) @@ -70,19 +51,19 @@ namespace osu.Game.Rulesets.Osu.Scoring private const double harshness = 0.01; - protected override void OnNewJudgement(Judgement judgement) + protected override void OnNewJudgement(JudgementResult result) { - base.OnNewJudgement(judgement); + base.OnNewJudgement(result); - var osuJudgement = (OsuJudgement)judgement; + var osuResult = (OsuJudgementResult)result; - if (judgement.Result != HitResult.None) + if (result.Type != HitResult.None) { - scoreResultCounts[judgement.Result] = scoreResultCounts.GetOrDefault(judgement.Result) + 1; - comboResultCounts[osuJudgement.Combo] = comboResultCounts.GetOrDefault(osuJudgement.Combo) + 1; + scoreResultCounts[result.Type] = scoreResultCounts.GetOrDefault(result.Type) + 1; + comboResultCounts[osuResult.ComboType] = comboResultCounts.GetOrDefault(osuResult.ComboType) + 1; } - switch (judgement.Result) + switch (result.Type) { case HitResult.Great: Health.Value += (10.2 - hpDrainRate) * harshness; diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index b0ba9afee6..8a898fb5e2 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -64,12 +64,12 @@ namespace osu.Game.Rulesets.Osu.UI connectionLayer.HitObjects = HitObjects.Objects.Select(d => d.HitObject).OfType(); } - private void onJudgement(DrawableHitObject judgedObject, Judgement judgement) + private void onJudgement(DrawableHitObject judgedObject, JudgementResult result) { if (!judgedObject.DisplayJudgement || !DisplayJudgements) return; - DrawableOsuJudgement explosion = new DrawableOsuJudgement(judgement, judgedObject) + DrawableOsuJudgement explosion = new DrawableOsuJudgement(result, judgedObject) { Origin = Anchor.Centre, Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition From 807794d512bdbd35d5e45d7fc0a20390ad79cf46 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 2 Aug 2018 20:36:54 +0900 Subject: [PATCH 250/304] Make Rulesets.Mania use the new judgement result structure --- .../Judgements/HoldNoteTailJudgement.cs | 27 -------------- .../Objects/Drawables/DrawableHoldNote.cs | 21 +++++------ .../Objects/Drawables/DrawableHoldNoteTick.cs | 5 +-- .../Objects/Drawables/DrawableNote.cs | 5 +-- osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 4 +-- .../Objects/HoldNoteTick.cs | 4 +-- osu.Game.Rulesets.Mania/Objects/Note.cs | 4 +-- osu.Game.Rulesets.Mania/Objects/TailNote.cs | 4 ++- .../Scoring/ManiaScoreProcessor.cs | 36 +++++++------------ osu.Game.Rulesets.Mania/UI/Column.cs | 4 +-- .../UI/DrawableManiaJudgement.cs | 6 ++-- osu.Game.Rulesets.Mania/UI/ManiaStage.cs | 4 +-- 12 files changed, 39 insertions(+), 85 deletions(-) delete mode 100644 osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs diff --git a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs deleted file mode 100644 index 3a4beda77d..0000000000 --- a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs +++ /dev/null @@ -1,27 +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.Scoring; - -namespace osu.Game.Rulesets.Mania.Judgements -{ - public class HoldNoteTailJudgement : ManiaJudgement - { - /// - /// Whether the hold note has been released too early and shouldn't give full score for the release. - /// - public bool HasBroken; - - protected override int NumericResultFor(HitResult result) - { - switch (result) - { - default: - return base.NumericResultFor(result); - case HitResult.Great: - case HitResult.Perfect: - return base.NumericResultFor(HasBroken ? HitResult.Good : result); - } - } - } -} diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index 2e64c1796a..a3a81245a2 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; using OpenTK.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets.Mania.Judgements; using osu.Framework.Input.Bindings; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI.Scrolling; @@ -100,7 +99,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (tail.AllJudged) - ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Perfect); + ApplyResult(Results.Single(), r => r.Type = HitResult.Perfect); } protected override void Update() @@ -166,7 +165,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables return false; // If the key has been released too early, the user should not receive full score for the release - if (HitObject.Judgement.Result == HitResult.Miss) + if (Results.Single().Type == HitResult.Miss) holdNote.hasBroken = true; // The head note also handles early hits before the body, but we want accurate early hits to count as the body being held @@ -205,13 +204,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (!userTriggered) { if (!HitObject.HitWindows.CanBeHit(timeOffset)) - { - ApplyJudgement(holdNote.HitObject.Tail.Judgement, j => - { - j.Result = HitResult.Miss; - ((HoldNoteTailJudgement)j).HasBroken = holdNote.hasBroken; - }); - } + ApplyResult(Results.Single(), r => r.Type = HitResult.Miss); return; } @@ -220,10 +213,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (result == HitResult.None) return; - ApplyJudgement(holdNote.HitObject.Tail.Judgement, j => + ApplyResult(Results.Single(), r => { - j.Result = result; - ((HoldNoteTailJudgement)j).HasBroken = holdNote.hasBroken; + if (holdNote.hasBroken && (result == HitResult.Perfect || result == HitResult.Perfect)) + result = HitResult.Good; + + r.Type = result; }); } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs index c281045591..6f718ef5ab 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Linq; using OpenTK; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; @@ -79,9 +80,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables var startTime = HoldStartTime?.Invoke(); if (startTime == null || startTime > HitObject.StartTime) - ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss); + ApplyResult(Results.Single(), r => r.Type = HitResult.Miss); else - ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Perfect); + ApplyResult(Results.Single(), r => r.Type = HitResult.Perfect); } } } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index bc1033bead..ad4969207d 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.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.Linq; using osu.Framework.Extensions.Color4Extensions; using OpenTK.Graphics; using osu.Framework.Graphics; @@ -60,7 +61,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (!userTriggered) { if (!HitObject.HitWindows.CanBeHit(timeOffset)) - ApplyJudgement(HitObject.Judgement, j => j.Result = HitResult.Miss); + ApplyResult(Results.Single(), r => r.Type = HitResult.Miss); return; } @@ -68,7 +69,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (result == HitResult.None) return; - ApplyJudgement(HitObject.Judgement, j => j.Result = result); + ApplyResult(Results.Single(), r => r.Type = result); } public virtual bool OnPressed(ManiaAction action) diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index 033434a989..8a22ff1bf6 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -98,8 +98,6 @@ namespace osu.Game.Rulesets.Mania.Objects } } - public HoldNoteJudgement Judgement { get; private set; } - - protected override IEnumerable CreateJudgements() => new[] { Judgement = new HoldNoteJudgement() }; + protected override IEnumerable CreateJudgements() => new[] { new HoldNoteJudgement() }; } } diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs index 73ad3d94ec..9056310cf2 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs @@ -12,8 +12,6 @@ namespace osu.Game.Rulesets.Mania.Objects /// public class HoldNoteTick : ManiaHitObject { - public HoldNoteTickJudgement Judgement { get; private set; } - - protected override IEnumerable CreateJudgements() => new[] { Judgement = new HoldNoteTickJudgement() }; + protected override IEnumerable CreateJudgements() => new[] { new HoldNoteTickJudgement() }; } } diff --git a/osu.Game.Rulesets.Mania/Objects/Note.cs b/osu.Game.Rulesets.Mania/Objects/Note.cs index ebda40de85..911bd2b0a2 100644 --- a/osu.Game.Rulesets.Mania/Objects/Note.cs +++ b/osu.Game.Rulesets.Mania/Objects/Note.cs @@ -12,8 +12,6 @@ namespace osu.Game.Rulesets.Mania.Objects /// public class Note : ManiaHitObject { - public virtual ManiaJudgement Judgement { get; } = new ManiaJudgement(); - - protected override IEnumerable CreateJudgements() => new[] { Judgement }; + protected override IEnumerable CreateJudgements() => new[] { new ManiaJudgement() }; } } diff --git a/osu.Game.Rulesets.Mania/Objects/TailNote.cs b/osu.Game.Rulesets.Mania/Objects/TailNote.cs index 530f3c6ff1..0f00ee3938 100644 --- a/osu.Game.Rulesets.Mania/Objects/TailNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/TailNote.cs @@ -1,12 +1,14 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Judgements; namespace osu.Game.Rulesets.Mania.Objects { public class TailNote : Note { - public override ManiaJudgement Judgement { get; } = new HoldNoteTailJudgement(); + protected override IEnumerable CreateJudgements() => new[] { new ManiaJudgement() }; } } diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index 4c955a680e..289bcc3d34 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.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.Linq; using osu.Game.Beatmaps; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Judgements; @@ -97,31 +96,20 @@ namespace osu.Game.Rulesets.Mania.Scoring { } - protected override void SimulateAutoplay(Beatmap beatmap) + protected override void ApplyBeatmap(Beatmap beatmap) { + base.ApplyBeatmap(beatmap); + BeatmapDifficulty difficulty = beatmap.BeatmapInfo.BaseDifficulty; hpMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.DrainRate, hp_multiplier_min, hp_multiplier_mid, hp_multiplier_max); hpMissMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.DrainRate, hp_multiplier_miss_min, hp_multiplier_miss_mid, hp_multiplier_miss_max); + } + protected override void SimulateAutoplay(Beatmap beatmap) + { while (true) { - foreach (var obj in beatmap.HitObjects) - { - var holdNote = obj as HoldNote; - - if (holdNote != null) - { - // Head - AddJudgement(new ManiaJudgement { Result = HitResult.Perfect }); - - // Ticks - int tickCount = holdNote.NestedHitObjects.OfType().Count(); - for (int i = 0; i < tickCount; i++) - AddJudgement(new HoldNoteTickJudgement { Result = HitResult.Perfect }); - } - - AddJudgement(new ManiaJudgement { Result = HitResult.Perfect }); - } + base.SimulateAutoplay(beatmap); if (!HasFailed) break; @@ -133,20 +121,20 @@ namespace osu.Game.Rulesets.Mania.Scoring } } - protected override void OnNewJudgement(Judgement judgement) + protected override void OnNewJudgement(JudgementResult result) { - base.OnNewJudgement(judgement); + base.OnNewJudgement(result); - bool isTick = judgement is HoldNoteTickJudgement; + bool isTick = result.Judgement is HoldNoteTickJudgement; if (isTick) { - if (judgement.IsHit) + if (result.IsHit) Health.Value += hpMultiplier * hp_increase_tick; } else { - switch (judgement.Result) + switch (result.Type) { case HitResult.Miss: Health.Value += hpMissMultiplier * hp_increase_miss; diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index 877189dd61..ca7173ec50 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -136,9 +136,9 @@ namespace osu.Game.Rulesets.Mania.UI HitObjects.Add(hitObject); } - internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) + internal void OnJudgement(DrawableHitObject judgedObject, JudgementResult result) { - if (!judgement.IsHit || !judgedObject.DisplayJudgement || !DisplayJudgements) + if (!result.IsHit || !judgedObject.DisplayJudgement || !DisplayJudgements) return; explosionContainer.Add(new HitExplosion(judgedObject) diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs index 6566d44ef5..dccd6f09fd 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs @@ -10,8 +10,8 @@ namespace osu.Game.Rulesets.Mania.UI { internal class DrawableManiaJudgement : DrawableJudgement { - public DrawableManiaJudgement(Judgement judgement, DrawableHitObject judgedObject) - : base(judgement, judgedObject) + public DrawableManiaJudgement(JudgementResult result, DrawableHitObject judgedObject) + : base(result, judgedObject) { } @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Mania.UI this.FadeInFromZero(50, Easing.OutQuint); - if (Judgement.IsHit) + if (Result.IsHit) { this.ScaleTo(0.8f); this.ScaleTo(1, 250, Easing.OutElastic); diff --git a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs index f386cf15a2..9072e044bd 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs @@ -161,13 +161,13 @@ namespace osu.Game.Rulesets.Mania.UI public void Add(BarLine barline) => base.Add(new DrawableBarLine(barline)); - internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) + internal void OnJudgement(DrawableHitObject judgedObject, JudgementResult result) { if (!judgedObject.DisplayJudgement || !DisplayJudgements) return; judgements.Clear(); - judgements.Add(new DrawableManiaJudgement(judgement, judgedObject) + judgements.Add(new DrawableManiaJudgement(result, judgedObject) { Anchor = Anchor.Centre, Origin = Anchor.Centre, From 9dff5cea07089425821a19cb1a385186a150eb02 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 2 Aug 2018 20:37:07 +0900 Subject: [PATCH 251/304] Make Rulesets.Catch use the new judgement result structure --- .../Judgements/CatchBananaJudgement.cs | 5 +- .../Judgements/CatchJudgement.cs | 30 ++++++------ osu.Game.Rulesets.Catch/Objects/Banana.cs | 4 +- .../Objects/CatchHitObject.cs | 8 ---- .../Drawable/DrawableCatchHitObject.cs | 7 ++- osu.Game.Rulesets.Catch/Objects/Droplet.cs | 6 ++- osu.Game.Rulesets.Catch/Objects/Fruit.cs | 6 ++- .../Objects/ICatchObjectWithJudgement.cs | 12 ----- .../Objects/TinyDroplet.cs | 4 +- .../Scoring/CatchScoreProcessor.cs | 46 ++++--------------- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 3 +- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 6 +-- 12 files changed, 50 insertions(+), 87 deletions(-) delete mode 100644 osu.Game.Rulesets.Catch/Objects/ICatchObjectWithJudgement.cs diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs index c39e663d75..f38009263f 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.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 osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Judgements @@ -9,8 +10,6 @@ namespace osu.Game.Rulesets.Catch.Judgements { public override bool AffectsCombo => false; - public override bool ShouldExplode => true; - protected override int NumericResultFor(HitResult result) { switch (result) @@ -32,5 +31,7 @@ namespace osu.Game.Rulesets.Catch.Judgements return 8; } } + + public override bool ShouldExplodeFor(JudgementResult result) => true; } } diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs index 51d7d3b5cd..8a51867899 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs @@ -23,21 +23,10 @@ namespace osu.Game.Rulesets.Catch.Judgements } /// - /// The base health increase for the result achieved. + /// Retrieves the numeric health increase of a . /// - public float HealthIncrease => HealthIncreaseFor(Result); - - /// - /// Whether fruit on the platter should explode or drop. - /// Note that this is only checked if the owning object is also - /// - public virtual bool ShouldExplode => IsHit; - - /// - /// Convert a to a base health increase. - /// - /// The value to convert. - /// The base health increase. + /// The to find the numeric health increase for. + /// The numeric health increase of . protected virtual float HealthIncreaseFor(HitResult result) { switch (result) @@ -48,5 +37,18 @@ namespace osu.Game.Rulesets.Catch.Judgements return 10.2f; } } + + /// + /// Retrieves the numeric health increase of a . + /// + /// The to find the numeric health increase for. + /// The numeric health increase of . + public float HealthIncreaseFor(JudgementResult result) => HealthIncreaseFor(result.Type); + + /// + /// Whether fruit on the platter should explode or drop. + /// Note that this is only checked if the owning object is also + /// + public virtual bool ShouldExplodeFor(JudgementResult result) => result.IsHit; } } diff --git a/osu.Game.Rulesets.Catch/Objects/Banana.cs b/osu.Game.Rulesets.Catch/Objects/Banana.cs index d0f4f6c5db..1b84869172 100644 --- a/osu.Game.Rulesets.Catch/Objects/Banana.cs +++ b/osu.Game.Rulesets.Catch/Objects/Banana.cs @@ -1,7 +1,9 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Game.Rulesets.Catch.Judgements; +using osu.Game.Rulesets.Judgements; namespace osu.Game.Rulesets.Catch.Objects { @@ -9,6 +11,6 @@ namespace osu.Game.Rulesets.Catch.Objects { public override FruitVisualRepresentation VisualRepresentation => FruitVisualRepresentation.Banana; - public override CatchJudgement Judgement { get; } = new CatchBananaJudgement(); + protected override IEnumerable CreateJudgements() => new[] { new CatchBananaJudgement() }; } } diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index 7f2cff561e..d55cdac115 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -1,10 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; @@ -56,12 +54,6 @@ namespace osu.Game.Rulesets.Catch.Objects } protected override HitWindows CreateHitWindows() => null; - - protected override IEnumerable CreateJudgements() - { - if (this is ICatchObjectWithJudgement judgeable) - yield return judgeable.Judgement; - } } public enum FruitVisualRepresentation diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs index 126977ecb2..019a4779ac 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Linq; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; @@ -56,10 +57,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { if (CheckPosition == null) return; - if (timeOffset >= 0 && HitObject is ICatchObjectWithJudgement judgeable) - { - ApplyJudgement(judgeable.Judgement, j => j.Result = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss); - } + if (timeOffset >= 0 && Results.Count > 0) + ApplyResult(Results.Single(), r => r.Type = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss); } protected override void SkinChanged(ISkinSource skin, bool allowFallback) diff --git a/osu.Game.Rulesets.Catch/Objects/Droplet.cs b/osu.Game.Rulesets.Catch/Objects/Droplet.cs index e92b06d0d1..a6e7d29305 100644 --- a/osu.Game.Rulesets.Catch/Objects/Droplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Droplet.cs @@ -1,12 +1,14 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Game.Rulesets.Catch.Judgements; +using osu.Game.Rulesets.Judgements; namespace osu.Game.Rulesets.Catch.Objects { - public class Droplet : CatchHitObject, ICatchObjectWithJudgement + public class Droplet : CatchHitObject { - public virtual CatchJudgement Judgement { get; } = new CatchDropletJudgement(); + protected override IEnumerable CreateJudgements() => new[] { new CatchDropletJudgement() }; } } diff --git a/osu.Game.Rulesets.Catch/Objects/Fruit.cs b/osu.Game.Rulesets.Catch/Objects/Fruit.cs index 4bcb1a400f..fd9cd13beb 100644 --- a/osu.Game.Rulesets.Catch/Objects/Fruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Fruit.cs @@ -1,12 +1,14 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Game.Rulesets.Catch.Judgements; +using osu.Game.Rulesets.Judgements; namespace osu.Game.Rulesets.Catch.Objects { - public class Fruit : CatchHitObject, ICatchObjectWithJudgement + public class Fruit : CatchHitObject { - public virtual CatchJudgement Judgement { get; } = new CatchJudgement(); + protected override IEnumerable CreateJudgements() => new[] { new CatchJudgement() }; } } diff --git a/osu.Game.Rulesets.Catch/Objects/ICatchObjectWithJudgement.cs b/osu.Game.Rulesets.Catch/Objects/ICatchObjectWithJudgement.cs deleted file mode 100644 index 2aa5a5c83a..0000000000 --- a/osu.Game.Rulesets.Catch/Objects/ICatchObjectWithJudgement.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.Catch.Judgements; - -namespace osu.Game.Rulesets.Catch.Objects -{ - public interface ICatchObjectWithJudgement - { - CatchJudgement Judgement { get; } - } -} diff --git a/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs b/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs index d7cc002dfc..069d3be5c0 100644 --- a/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs @@ -1,12 +1,14 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Game.Rulesets.Catch.Judgements; +using osu.Game.Rulesets.Judgements; namespace osu.Game.Rulesets.Catch.Objects { public class TinyDroplet : Droplet { - public override CatchJudgement Judgement { get; } = new CatchTinyDropletJudgement(); + protected override IEnumerable CreateJudgements() => new[] { new CatchTinyDropletJudgement() }; } } diff --git a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs index 5b69d836a3..183c6f0f12 100644 --- a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Linq; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Catch.Objects; @@ -21,55 +20,28 @@ namespace osu.Game.Rulesets.Catch.Scoring private float hpDrainRate; - protected override void SimulateAutoplay(Beatmap beatmap) + protected override void ApplyBeatmap(Beatmap beatmap) { - hpDrainRate = beatmap.BeatmapInfo.BaseDifficulty.DrainRate; + base.ApplyBeatmap(beatmap); - foreach (var obj in beatmap.HitObjects) - { - switch (obj) - { - case JuiceStream stream: - foreach (var nestedObject in stream.NestedHitObjects) - switch (nestedObject) - { - case TinyDroplet _: - AddJudgement(new CatchTinyDropletJudgement { Result = HitResult.Perfect }); - break; - case Droplet _: - AddJudgement(new CatchDropletJudgement { Result = HitResult.Perfect }); - break; - case Fruit _: - AddJudgement(new CatchJudgement { Result = HitResult.Perfect }); - break; - } - break; - case BananaShower shower: - foreach (var _ in shower.NestedHitObjects.Cast()) - AddJudgement(new CatchBananaJudgement { Result = HitResult.Perfect }); - break; - case Fruit _: - AddJudgement(new CatchJudgement { Result = HitResult.Perfect }); - break; - } - } + hpDrainRate = beatmap.BeatmapInfo.BaseDifficulty.DrainRate; } private const double harshness = 0.01; - protected override void OnNewJudgement(Judgement judgement) + protected override void OnNewJudgement(JudgementResult result) { - base.OnNewJudgement(judgement); + base.OnNewJudgement(result); - if (judgement.Result == HitResult.Miss) + if (result.Type == HitResult.Miss) { - if (!judgement.IsBonus) + if (!result.Judgement.IsBonus) Health.Value -= hpDrainRate * (harshness * 2); return; } - if (judgement is CatchJudgement catchJudgement) - Health.Value += Math.Max(catchJudgement.HealthIncrease - hpDrainRate, 0) * harshness; + if (result.Judgement is CatchJudgement catchJudgement) + Health.Value += Math.Max(catchJudgement.HealthIncreaseFor(result) - hpDrainRate, 0) * harshness; } } } diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index ea3b6fb0e0..7b52066d15 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -67,6 +67,7 @@ namespace osu.Game.Rulesets.Catch.UI fruit.CheckPosition = CheckIfWeCanCatch; } - private void onJudgement(DrawableHitObject judgedObject, Judgement judgement) => catcherArea.OnJudgement((DrawableCatchHitObject)judgedObject, judgement); + private void onJudgement(DrawableHitObject judgedObject, JudgementResult result) + => catcherArea.OnJudgement((DrawableCatchHitObject)judgedObject, result); } } diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 7b06426b07..ca9fa6f595 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Catch.UI private DrawableCatchHitObject lastPlateableFruit; - public void OnJudgement(DrawableCatchHitObject fruit, Judgement judgement) + public void OnJudgement(DrawableCatchHitObject fruit, JudgementResult result) { void runAfterLoaded(Action action) { @@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Catch.UI lastPlateableFruit.OnLoadComplete = _ => action(); } - if (judgement.IsHit && fruit.CanBePlated) + if (result.IsHit && fruit.CanBePlated) { var caughtFruit = (DrawableCatchHitObject)GetVisualRepresentation?.Invoke(fruit.HitObject); @@ -86,7 +86,7 @@ namespace osu.Game.Rulesets.Catch.UI if (fruit.HitObject.LastInCombo) { - if (((CatchJudgement)judgement).ShouldExplode) + if (((CatchJudgement)result.Judgement).ShouldExplodeFor(result)) runAfterLoaded(() => MovableCatcher.Explode()); else MovableCatcher.Drop(); From 8d81e66f886f0e10f2d7232087c562a96c578f6a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 2 Aug 2018 21:07:11 +0900 Subject: [PATCH 252/304] Fix osu score processor crashing --- osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs | 2 ++ osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index a8f656bc6b..2986b4b5dc 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -86,5 +86,7 @@ namespace osu.Game.Rulesets.Osu.Scoring break; } } + + protected override JudgementResult CreateJudgementResult(Judgement judgement) => new OsuJudgementResult(judgement); } } diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index ccd3fb6e69..64dcf150cf 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -225,7 +225,12 @@ namespace osu.Game.Rulesets.Scoring simulate(nested); foreach (var judgement in obj.Judgements) - AddJudgement(new JudgementResult(judgement) { Type = judgement.MaxResult }); + { + var result = CreateJudgementResult(judgement); + result.Type = judgement.MaxResult; + + AddJudgement(result); + } } } @@ -350,6 +355,8 @@ namespace osu.Game.Rulesets.Scoring rollingMaxBaseScore = 0; bonusScore = 0; } + + protected virtual JudgementResult CreateJudgementResult(Judgement judgement) => new JudgementResult(judgement); } public enum ScoringMode From 35b4ab545646b80501a7d12a60957f67459b14e7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 2 Aug 2018 21:07:31 +0900 Subject: [PATCH 253/304] Introduce the concept of a "MainResult" --- osu.Game.Rulesets.Taiko/Objects/Swell.cs | 4 +-- .../Objects/Drawables/DrawableHitObject.cs | 28 +++++++++++++------ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs index 2dec6019eb..fef7f4b889 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Swell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs @@ -21,10 +21,10 @@ namespace osu.Game.Rulesets.Taiko.Objects protected override IEnumerable CreateJudgements() { - yield return new TaikoJudgement(); - for (int i = 0; i < RequiredHits; i++) yield return new TaikoIntermediateSwellJudgement(); + + yield return new TaikoJudgement(); } } } diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 27de18177f..06f2d689d8 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -62,6 +62,13 @@ namespace osu.Game.Rulesets.Objects.Drawables private readonly List results = new List(); public IReadOnlyList Results => results; + /// + /// The that affects whether this has been hit or missed. + /// By default, this is the last in , and should be overridden if the order + /// of s in doesn't list the main as its last element. + /// + protected virtual JudgementResult MainResult => Results.LastOrDefault(); + private bool judgementOccurred; public bool Interactive = true; @@ -192,16 +199,19 @@ namespace osu.Game.Rulesets.Objects.Drawables var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; result.TimeOffset = Time.Current - endTime; - switch (result.Type) + if (result == MainResult) { - case HitResult.None: - break; - case HitResult.Miss: - State.Value = ArmedState.Miss; - break; - default: - State.Value = ArmedState.Hit; - break; + switch (result.Type) + { + case HitResult.None: + break; + case HitResult.Miss: + State.Value = ArmedState.Miss; + break; + default: + State.Value = ArmedState.Hit; + break; + } } OnJudgement?.Invoke(this, result); From a0887a600f671453b8221141e004c41e87f5097e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 2 Aug 2018 21:08:06 +0900 Subject: [PATCH 254/304] Fix swells showing hit circles on intermediate judgements --- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 40198a701a..7147972c58 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -229,7 +229,10 @@ namespace osu.Game.Rulesets.Taiko.UI if (!DisplayJudgements) return; - if (judgedObject.DisplayJudgement && judgementContainer.FirstOrDefault(j => j.JudgedObject == judgedObject) == null) + if (!judgedObject.DisplayJudgement) + return; + + if (judgementContainer.FirstOrDefault(j => j.JudgedObject == judgedObject) == null) { judgementContainer.Add(new DrawableTaikoJudgement(result, judgedObject) { From 0da6c8c1a7931980a4e35f4d0b5519776548b344 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 2 Aug 2018 22:20:07 +0900 Subject: [PATCH 255/304] Remove unnecessary local variables --- osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs index 58f6a2840a..7e36a896c1 100644 --- a/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs @@ -25,15 +25,12 @@ namespace osu.Game.Rulesets.Taiko.Objects /// public double HitWindow => TickSpacing / 2; - public TaikoDrumRollTickJudgement Judgement { get; private set; } - public TaikoStrongHitJudgement StrongJudgement { get; private set; } - protected override IEnumerable CreateJudgements() { - yield return Judgement = new TaikoDrumRollTickJudgement(); + yield return new TaikoDrumRollTickJudgement(); if (IsStrong) - yield return StrongJudgement = new TaikoStrongHitJudgement(); + yield return new TaikoStrongHitJudgement(); } } } From 2a4994e5cedc64ae7bf5d7d49b7e9573557af6c5 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 3 Aug 2018 15:38:48 +0900 Subject: [PATCH 256/304] Make hitobjects only have one judgement + result --- osu.Game.Rulesets.Catch/Objects/Banana.cs | 3 +- .../Drawable/DrawableCatchHitObject.cs | 5 +- osu.Game.Rulesets.Catch/Objects/Droplet.cs | 3 +- osu.Game.Rulesets.Catch/Objects/Fruit.cs | 3 +- .../Objects/TinyDroplet.cs | 3 +- .../Objects/Drawables/DrawableHoldNote.cs | 8 +-- .../Objects/Drawables/DrawableHoldNoteTick.cs | 5 +- .../Objects/Drawables/DrawableNote.cs | 5 +- osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 3 +- .../Objects/HoldNoteTick.cs | 3 +- osu.Game.Rulesets.Mania/Objects/Note.cs | 3 +- osu.Game.Rulesets.Mania/Objects/TailNote.cs | 3 +- .../TestCaseHitCircle.cs | 2 +- .../Objects/Drawables/DrawableHitCircle.cs | 5 +- .../Objects/Drawables/DrawableOsuHitObject.cs | 3 +- .../Objects/Drawables/DrawableRepeatPoint.cs | 3 +- .../Objects/Drawables/DrawableSlider.cs | 6 +- .../Objects/Drawables/DrawableSliderTail.cs | 3 +- .../Objects/Drawables/DrawableSliderTick.cs | 3 +- .../Objects/Drawables/DrawableSpinner.cs | 2 +- osu.Game.Rulesets.Osu/Objects/HitCircle.cs | 3 +- osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs | 3 +- osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 +- .../Objects/SliderTailCircle.cs | 3 +- osu.Game.Rulesets.Osu/Objects/SliderTick.cs | 3 +- osu.Game.Rulesets.Osu/Objects/Spinner.cs | 3 +- .../Objects/Drawables/DrawableHitObject.cs | 64 +++++++------------ osu.Game/Rulesets/Objects/HitObject.cs | 9 +-- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 12 ++-- 29 files changed, 66 insertions(+), 110 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Banana.cs b/osu.Game.Rulesets.Catch/Objects/Banana.cs index 1b84869172..e021bafdb6 100644 --- a/osu.Game.Rulesets.Catch/Objects/Banana.cs +++ b/osu.Game.Rulesets.Catch/Objects/Banana.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.Collections.Generic; using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Judgements; @@ -11,6 +10,6 @@ namespace osu.Game.Rulesets.Catch.Objects { public override FruitVisualRepresentation VisualRepresentation => FruitVisualRepresentation.Banana; - protected override IEnumerable CreateJudgements() => new[] { new CatchBananaJudgement() }; + protected override Judgement CreateJudgement() => new CatchBananaJudgement(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs index 019a4779ac..982fa193c6 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Linq; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; @@ -57,8 +56,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { if (CheckPosition == null) return; - if (timeOffset >= 0 && Results.Count > 0) - ApplyResult(Results.Single(), r => r.Type = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss); + if (timeOffset >= 0 && Result != null) + ApplyResult(r => r.Type = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss); } protected override void SkinChanged(ISkinSource skin, bool allowFallback) diff --git a/osu.Game.Rulesets.Catch/Objects/Droplet.cs b/osu.Game.Rulesets.Catch/Objects/Droplet.cs index a6e7d29305..79aefdb6d3 100644 --- a/osu.Game.Rulesets.Catch/Objects/Droplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Droplet.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.Collections.Generic; using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Judgements; @@ -9,6 +8,6 @@ namespace osu.Game.Rulesets.Catch.Objects { public class Droplet : CatchHitObject { - protected override IEnumerable CreateJudgements() => new[] { new CatchDropletJudgement() }; + protected override Judgement CreateJudgement() => new CatchDropletJudgement(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/Fruit.cs b/osu.Game.Rulesets.Catch/Objects/Fruit.cs index fd9cd13beb..53a484ed56 100644 --- a/osu.Game.Rulesets.Catch/Objects/Fruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Fruit.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.Collections.Generic; using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Judgements; @@ -9,6 +8,6 @@ namespace osu.Game.Rulesets.Catch.Objects { public class Fruit : CatchHitObject { - protected override IEnumerable CreateJudgements() => new[] { new CatchJudgement() }; + protected override Judgement CreateJudgement() => new CatchJudgement(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs b/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs index 069d3be5c0..ddb88c2c1c 100644 --- a/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/TinyDroplet.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.Collections.Generic; using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Judgements; @@ -9,6 +8,6 @@ namespace osu.Game.Rulesets.Catch.Objects { public class TinyDroplet : Droplet { - protected override IEnumerable CreateJudgements() => new[] { new CatchTinyDropletJudgement() }; + protected override Judgement CreateJudgement() => new CatchTinyDropletJudgement(); } } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index a3a81245a2..da4bf1c575 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -99,7 +99,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (tail.AllJudged) - ApplyResult(Results.Single(), r => r.Type = HitResult.Perfect); + ApplyResult(r => r.Type = HitResult.Perfect); } protected override void Update() @@ -165,7 +165,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables return false; // If the key has been released too early, the user should not receive full score for the release - if (Results.Single().Type == HitResult.Miss) + if (Result.Type == HitResult.Miss) holdNote.hasBroken = true; // The head note also handles early hits before the body, but we want accurate early hits to count as the body being held @@ -204,7 +204,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (!userTriggered) { if (!HitObject.HitWindows.CanBeHit(timeOffset)) - ApplyResult(Results.Single(), r => r.Type = HitResult.Miss); + ApplyResult(r => r.Type = HitResult.Miss); return; } @@ -213,7 +213,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (result == HitResult.None) return; - ApplyResult(Results.Single(), r => + ApplyResult(r => { if (holdNote.hasBroken && (result == HitResult.Perfect || result == HitResult.Perfect)) result = HitResult.Good; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs index 6f718ef5ab..05a4ea60d6 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Linq; using OpenTK; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; @@ -80,9 +79,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables var startTime = HoldStartTime?.Invoke(); if (startTime == null || startTime > HitObject.StartTime) - ApplyResult(Results.Single(), r => r.Type = HitResult.Miss); + ApplyResult(r => r.Type = HitResult.Miss); else - ApplyResult(Results.Single(), r => r.Type = HitResult.Perfect); + ApplyResult(r => r.Type = HitResult.Perfect); } } } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index ad4969207d..42b4128019 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.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.Linq; using osu.Framework.Extensions.Color4Extensions; using OpenTK.Graphics; using osu.Framework.Graphics; @@ -61,7 +60,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (!userTriggered) { if (!HitObject.HitWindows.CanBeHit(timeOffset)) - ApplyResult(Results.Single(), r => r.Type = HitResult.Miss); + ApplyResult(r => r.Type = HitResult.Miss); return; } @@ -69,7 +68,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (result == HitResult.None) return; - ApplyResult(Results.Single(), r => r.Type = result); + ApplyResult(r => r.Type = result); } public virtual bool OnPressed(ManiaAction action) diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index 8a22ff1bf6..26116c2691 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.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.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Judgements; @@ -98,6 +97,6 @@ namespace osu.Game.Rulesets.Mania.Objects } } - protected override IEnumerable CreateJudgements() => new[] { new HoldNoteJudgement() }; + protected override Judgement CreateJudgement() => new HoldNoteJudgement(); } } diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs index 9056310cf2..b428c6158d 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.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.Collections.Generic; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Judgements; @@ -12,6 +11,6 @@ namespace osu.Game.Rulesets.Mania.Objects /// public class HoldNoteTick : ManiaHitObject { - protected override IEnumerable CreateJudgements() => new[] { new HoldNoteTickJudgement() }; + protected override Judgement CreateJudgement() => new HoldNoteTickJudgement(); } } diff --git a/osu.Game.Rulesets.Mania/Objects/Note.cs b/osu.Game.Rulesets.Mania/Objects/Note.cs index 911bd2b0a2..ffc3ed0bd7 100644 --- a/osu.Game.Rulesets.Mania/Objects/Note.cs +++ b/osu.Game.Rulesets.Mania/Objects/Note.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.Collections.Generic; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Judgements; @@ -12,6 +11,6 @@ namespace osu.Game.Rulesets.Mania.Objects /// public class Note : ManiaHitObject { - protected override IEnumerable CreateJudgements() => new[] { new ManiaJudgement() }; + protected override Judgement CreateJudgement() => new ManiaJudgement(); } } diff --git a/osu.Game.Rulesets.Mania/Objects/TailNote.cs b/osu.Game.Rulesets.Mania/Objects/TailNote.cs index 0f00ee3938..522f78336f 100644 --- a/osu.Game.Rulesets.Mania/Objects/TailNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/TailNote.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.Collections.Generic; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Judgements; @@ -9,6 +8,6 @@ namespace osu.Game.Rulesets.Mania.Objects { public class TailNote : Note { - protected override IEnumerable CreateJudgements() => new[] { new ManiaJudgement() }; + protected override Judgement CreateJudgement() => new ManiaJudgement(); } } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs index e44016e48b..79866b8a4a 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs @@ -99,7 +99,7 @@ namespace osu.Game.Rulesets.Osu.Tests if (auto && !userTriggered && timeOffset > 0) { // force success - ApplyResult(Results.Single(), r => r.Type = HitResult.Great); + ApplyResult(r => r.Type = HitResult.Great); } else base.CheckForJudgements(userTriggered, timeOffset); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index a09748e450..15521113ed 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Linq; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; @@ -82,7 +81,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables if (!userTriggered) { if (!HitObject.HitWindows.CanBeHit(timeOffset)) - ApplyResult(Results.Single(), r => r.Type = HitResult.Miss); + ApplyResult(r => r.Type = HitResult.Miss); return; } @@ -91,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables if (result == HitResult.None) return; - ApplyResult(Results.Single(), r => r.Type = result); + ApplyResult(r => r.Type = result); } protected override void UpdatePreemptState() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 187cbc29a2..2529ac20c4 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -4,7 +4,6 @@ using System; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Graphics; -using System.Linq; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Judgements; @@ -35,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { UpdatePreemptState(); - var judgementOffset = Math.Min(HitObject.HitWindows.HalfWindowFor(HitResult.Miss), Results.FirstOrDefault()?.TimeOffset ?? 0); + var judgementOffset = Math.Min(HitObject.HitWindows.HalfWindowFor(HitResult.Miss), Result?.TimeOffset ?? 0); using (BeginDelayedSequence(HitObject.TimePreempt + judgementOffset, true)) UpdateCurrentState(state); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index 7ef56f07e2..ea1ee9fb1e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using osu.Framework.Graphics; using osu.Framework.MathUtils; using osu.Game.Rulesets.Objects.Drawables; @@ -45,7 +44,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (repeatPoint.StartTime <= Time.Current) - ApplyResult(Results.Single(), r => r.Type = drawableSlider.Tracking ? HitResult.Great : HitResult.Miss); + ApplyResult(r => r.Type = drawableSlider.Tracking ? HitResult.Great : HitResult.Miss); } protected override void UpdatePreemptState() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index fc6510471b..71be07f166 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -136,16 +136,16 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables if (userTriggered || Time.Current < slider.EndTime) return; - ApplyResult(Results.Single(), r => + ApplyResult(r => { var judgementsCount = NestedHitObjects.Count(); var judgementsHit = NestedHitObjects.Count(h => h.IsHit); var hitFraction = (double)judgementsHit / judgementsCount; - if (hitFraction == 1 && HeadCircle.Results.Single().Type == HitResult.Great) + if (hitFraction == 1 && HeadCircle.Result.Type == HitResult.Great) r.Type = HitResult.Great; - else if (hitFraction >= 0.5 && HeadCircle.Results.Single().Type >= HitResult.Good) + else if (hitFraction >= 0.5 && HeadCircle.Result.Type >= HitResult.Good) r.Type = HitResult.Good; else if (hitFraction > 0) r.Type = HitResult.Meh; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs index 7cbb7db6d4..9261741a12 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.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.Linq; using osu.Framework.Graphics; using osu.Game.Rulesets.Scoring; @@ -32,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (!userTriggered && timeOffset >= 0) - ApplyResult(Results.Single(), r => r.Type = Tracking ? HitResult.Great : HitResult.Miss); + ApplyResult(r => r.Type = Tracking ? HitResult.Great : HitResult.Miss); } } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index c4c853cb58..8819fa962b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.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.Linq; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; @@ -51,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (timeOffset >= 0) - ApplyResult(Results.Single(), r => r.Type = Tracking ? HitResult.Great : HitResult.Miss); + ApplyResult(r => r.Type = Tracking ? HitResult.Great : HitResult.Miss); } protected override void UpdatePreemptState() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 4db928c578..3feb612c8b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -138,7 +138,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables if (userTriggered || Time.Current < Spinner.EndTime) return; - ApplyResult(Results.Single(), r => + ApplyResult(r => { if (Progress >= 1) r.Type = HitResult.Great; diff --git a/osu.Game.Rulesets.Osu/Objects/HitCircle.cs b/osu.Game.Rulesets.Osu/Objects/HitCircle.cs index 2514988e9f..b5e64e9e40 100644 --- a/osu.Game.Rulesets.Osu/Objects/HitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/HitCircle.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.Collections.Generic; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.Judgements; @@ -9,6 +8,6 @@ namespace osu.Game.Rulesets.Osu.Objects { public class HitCircle : OsuHitObject { - protected override IEnumerable CreateJudgements() => new[] { new OsuJudgement() }; + protected override Judgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs index ef794eafdb..83f7f79f39 100644 --- a/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Judgements; @@ -28,6 +27,6 @@ namespace osu.Game.Rulesets.Osu.Objects TimePreempt = Math.Min(SpanDuration * 2, TimePreempt); } - protected override IEnumerable CreateJudgements() => new[] { new OsuJudgement() }; + protected override Judgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 54899fb9f5..eead98ac28 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -214,6 +214,6 @@ namespace osu.Game.Rulesets.Osu.Objects } } - protected override IEnumerable CreateJudgements() => new[] { new OsuJudgement() }; + protected override Judgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs index 93c8d94920..faa325d416 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.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.Collections.Generic; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.Judgements; @@ -14,6 +13,6 @@ namespace osu.Game.Rulesets.Osu.Objects { } - protected override IEnumerable CreateJudgements() => new[] { new OsuSliderTailJudgement() }; + protected override Judgement CreateJudgement() => new OsuSliderTailJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs index 24ab812649..000781dec6 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTick.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.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Judgements; @@ -30,6 +29,6 @@ namespace osu.Game.Rulesets.Osu.Objects TimePreempt = (StartTime - SpanStartTime) / 2 + offset; } - protected override IEnumerable CreateJudgements() => new[] { new OsuJudgement() }; + protected override Judgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index f7bb806503..d100e33f17 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects.Types; using osu.Game.Beatmaps.ControlPoints; @@ -33,6 +32,6 @@ namespace osu.Game.Rulesets.Osu.Objects SpinsRequired = (int)Math.Max(1, SpinsRequired * 0.6); } - protected override IEnumerable CreateJudgements() => new[] { new OsuJudgement() }; + protected override Judgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 06f2d689d8..2b2daec8c6 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Objects.Drawables /// /// Whether this and all of its nested s have been hit. /// - public bool IsHit => Results.All(j => j.IsHit) && NestedHitObjects.All(n => n.IsHit); + public bool IsHit => (Result?.IsHit ?? true) && NestedHitObjects.All(n => n.IsHit); /// /// Whether this and all of its nested s have been judged. @@ -57,17 +57,9 @@ namespace osu.Game.Rulesets.Objects.Drawables /// Whether this has been judged. /// Note: This does NOT include nested hitobjects. /// - public bool Judged => Results.All(h => h.HasResult); + public bool Judged => Result?.HasResult ?? true; - private readonly List results = new List(); - public IReadOnlyList Results => results; - - /// - /// The that affects whether this has been hit or missed. - /// By default, this is the last in , and should be overridden if the order - /// of s in doesn't list the main as its last element. - /// - protected virtual JudgementResult MainResult => Results.LastOrDefault(); + public readonly JudgementResult Result; private bool judgementOccurred; @@ -85,8 +77,8 @@ namespace osu.Game.Rulesets.Objects.Drawables { HitObject = hitObject; - foreach (var j in hitObject.Judgements) - results.Add(CreateJudgementResult(j)); + if (hitObject.Judgement != null) + Result = CreateJudgementResult(hitObject.Judgement); } [BackgroundDependencyLoader] @@ -144,20 +136,15 @@ namespace osu.Game.Rulesets.Objects.Drawables { base.Update(); - if (lastUpdateTime > Time.Current) + if (Result != null && lastUpdateTime > Time.Current) { var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; - for (int i = Results.Count - 1; i >= 0; i--) + if (Result.TimeOffset + endTime < Time.Current) { - var judgement = Results[i]; + OnJudgementRemoved?.Invoke(this, Result); - if (judgement.TimeOffset + endTime <= Time.Current) - break; - - OnJudgementRemoved?.Invoke(this, judgement); - - judgement.Type = HitResult.None; + Result.Type = HitResult.None; State.Value = ArmedState.Idle; } } @@ -185,36 +172,29 @@ namespace osu.Game.Rulesets.Objects.Drawables /// Notifies that a new judgement has occurred for this . /// /// The . - protected void ApplyResult(JudgementResult result, Action application) + protected void ApplyResult(Action application) { - // Todo: Unsure if we want to keep this - if (!Results.Contains(result)) - throw new ArgumentException($"The applied judgement result must be a part of {Results}."); - - application?.Invoke(result); + application?.Invoke(Result); judgementOccurred = true; // Ensure that the judgement is given a valid time offset, because this may not get set by the caller var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; - result.TimeOffset = Time.Current - endTime; + Result.TimeOffset = Time.Current - endTime; - if (result == MainResult) + switch (Result.Type) { - switch (result.Type) - { - case HitResult.None: - break; - case HitResult.Miss: - State.Value = ArmedState.Miss; - break; - default: - State.Value = ArmedState.Hit; - break; - } + case HitResult.None: + break; + case HitResult.Miss: + State.Value = ArmedState.Miss; + break; + default: + State.Value = ArmedState.Hit; + break; } - OnJudgement?.Invoke(this, result); + OnJudgement?.Invoke(this, Result); } /// diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index 0e029a8657..531a8bed38 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using Newtonsoft.Json; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Lists; @@ -64,8 +63,7 @@ namespace osu.Game.Rulesets.Objects [JsonIgnore] public IReadOnlyList NestedHitObjects => nestedHitObjects.Value; - private readonly List judgements = new List(); - public IReadOnlyList Judgements => judgements; + public Judgement Judgement { get; private set; } /// /// Applies default values to this HitObject. @@ -76,8 +74,7 @@ namespace osu.Game.Rulesets.Objects { ApplyDefaultsToSelf(controlPointInfo, difficulty); - judgements.Clear(); - judgements.AddRange(CreateJudgements()); + Judgement = CreateJudgement(); if (nestedHitObjects.IsValueCreated) nestedHitObjects.Value.Clear(); @@ -111,7 +108,7 @@ namespace osu.Game.Rulesets.Objects { } - protected virtual IEnumerable CreateJudgements() => Enumerable.Empty(); + protected virtual Judgement CreateJudgement() => null; protected void AddNested(HitObject hitObject) => nestedHitObjects.Value.Add(hitObject); diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 64dcf150cf..985cfce6aa 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -224,13 +224,13 @@ namespace osu.Game.Rulesets.Scoring foreach (var nested in obj.NestedHitObjects) simulate(nested); - foreach (var judgement in obj.Judgements) - { - var result = CreateJudgementResult(judgement); - result.Type = judgement.MaxResult; + if (obj.Judgement == null) + return; - AddJudgement(result); - } + var result = CreateJudgementResult(obj.Judgement); + result.Type = obj.Judgement.MaxResult; + + AddJudgement(result); } } From 482526135fb1396de1ceed319e9f7ebafccf9589 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 3 Aug 2018 16:07:20 +0900 Subject: [PATCH 257/304] Make IsHit not consider nested hitobjects --- .../Rulesets/Objects/Drawables/DrawableHitObject.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 2b2daec8c6..a22a7a616b 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -43,16 +43,17 @@ namespace osu.Game.Rulesets.Objects.Drawables /// public virtual bool DisplayJudgement => true; - /// - /// Whether this and all of its nested s have been hit. - /// - public bool IsHit => (Result?.IsHit ?? true) && NestedHitObjects.All(n => n.IsHit); - /// /// Whether this and all of its nested s have been judged. /// public bool AllJudged => Judged && NestedHitObjects.All(h => h.AllJudged); + /// + /// Whether this has been hit. This occurs if is . + /// Note: This does NOT include nested hitobjects. + /// + public bool IsHit => Result?.IsHit ?? false; + /// /// Whether this has been judged. /// Note: This does NOT include nested hitobjects. From fa3c919e2e986ee8ca74e21df052d136dfa25c40 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 3 Aug 2018 16:11:38 +0900 Subject: [PATCH 258/304] Fix up taiko judgement creation --- osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs | 11 ----------- osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs | 9 +-------- osu.Game.Rulesets.Taiko/Objects/Hit.cs | 11 ----------- osu.Game.Rulesets.Taiko/Objects/Swell.cs | 11 ----------- osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs | 4 ++++ 5 files changed, 5 insertions(+), 41 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs index 2ed59d3c43..4c9ec5473b 100644 --- a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs @@ -3,11 +3,8 @@ using osu.Game.Rulesets.Objects.Types; using System; -using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Taiko.Judgements; namespace osu.Game.Rulesets.Taiko.Objects { @@ -84,13 +81,5 @@ namespace osu.Game.Rulesets.Taiko.Objects first = false; } } - - protected override IEnumerable CreateJudgements() - { - yield return new TaikoJudgement(); - - if (IsStrong) - yield return new TaikoStrongHitJudgement(); - } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs index 7e36a896c1..f6a3a5efef 100644 --- a/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.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.Collections.Generic; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Taiko.Judgements; @@ -25,12 +24,6 @@ namespace osu.Game.Rulesets.Taiko.Objects /// public double HitWindow => TickSpacing / 2; - protected override IEnumerable CreateJudgements() - { - yield return new TaikoDrumRollTickJudgement(); - - if (IsStrong) - yield return new TaikoStrongHitJudgement(); - } + protected override Judgement CreateJudgement() => new TaikoDrumRollTickJudgement(); } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Hit.cs b/osu.Game.Rulesets.Taiko/Objects/Hit.cs index 6795aef730..0b47aa490b 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Hit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Hit.cs @@ -1,20 +1,9 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; -using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Taiko.Judgements; - namespace osu.Game.Rulesets.Taiko.Objects { public class Hit : TaikoHitObject { - protected override IEnumerable CreateJudgements() - { - yield return new TaikoJudgement(); - - if (IsStrong) - yield return new TaikoStrongHitJudgement(); - } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs index fef7f4b889..eb6f931af4 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Swell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs @@ -1,10 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; -using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Types; -using osu.Game.Rulesets.Taiko.Judgements; namespace osu.Game.Rulesets.Taiko.Objects { @@ -18,13 +15,5 @@ namespace osu.Game.Rulesets.Taiko.Objects /// The number of hits required to complete the swell successfully. /// public int RequiredHits = 10; - - protected override IEnumerable CreateJudgements() - { - for (int i = 0; i < RequiredHits; i++) - yield return new TaikoIntermediateSwellJudgement(); - - yield return new TaikoJudgement(); - } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs index ffbbe28f2e..f3dfb333b3 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs @@ -1,7 +1,9 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Taiko.Judgements; namespace osu.Game.Rulesets.Taiko.Objects { @@ -28,6 +30,8 @@ namespace osu.Game.Rulesets.Taiko.Objects /// public bool IsStrong; + protected override Judgement CreateJudgement() => new TaikoJudgement(); + protected override HitWindows CreateHitWindows() => new TaikoHitWindows(); } } From 2dff04392e96cc8ddee313d3b616f1b91dc7c51e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 3 Aug 2018 16:11:57 +0900 Subject: [PATCH 259/304] Re-implement strong judgements via hitobject --- .../Drawables/DrawableStrongHitObject.cs | 19 +++++++++++++++++++ .../Drawables/DrawableTaikoHitObject.cs | 13 +++++++++++++ osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs | 4 ++-- .../Objects/StrongHitObject.cs | 13 +++++++++++++ .../Objects/TaikoHitObject.cs | 8 ++++++++ 5 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs create mode 100644 osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs new file mode 100644 index 0000000000..e9d12e9c35 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs @@ -0,0 +1,19 @@ +// 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.Taiko.Objects.Drawables +{ + public abstract class DrawableStrongHitObject : DrawableTaikoHitObject + { + protected DrawableStrongHitObject(StrongHitObject strong) + : base(strong) + { + } + + protected override void UpdateState(ArmedState state) + { + } + } +} diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index a6d61f1a5a..b0216768c1 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -101,6 +101,17 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables Content.Add(MainPiece = CreateMainPiece()); MainPiece.KiaiMode = HitObject.Kiai; + + var strongObject = HitObject.NestedHitObjects.OfType().FirstOrDefault(); + if (strongObject != null) + { + var vis = CreateStrongObject(strongObject); + if (vis != null) + { + AddNested(vis); + AddInternal(vis); + } + } } // Normal and clap samples are handled by the drum @@ -109,5 +120,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override string SampleNamespace => "Taiko"; protected virtual TaikoPiece CreateMainPiece() => new CirclePiece(); + + protected virtual DrawableStrongHitObject CreateStrongObject(StrongHitObject hitObject) => null; } } diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs index 4c9ec5473b..405ea85f0d 100644 --- a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs @@ -54,12 +54,12 @@ namespace osu.Game.Rulesets.Taiko.Objects protected override void CreateNestedHitObjects() { - base.CreateNestedHitObjects(); - createTicks(); RequiredGoodHits = NestedHitObjects.Count * Math.Min(0.15, 0.05 + 0.10 / 6 * overallDifficulty); RequiredGreatHits = NestedHitObjects.Count * Math.Min(0.30, 0.10 + 0.20 / 6 * overallDifficulty); + + base.CreateNestedHitObjects(); } private void createTicks() diff --git a/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs new file mode 100644 index 0000000000..104d662ed8 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs @@ -0,0 +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.Judgements; +using osu.Game.Rulesets.Taiko.Judgements; + +namespace osu.Game.Rulesets.Taiko.Objects +{ + public class StrongHitObject : TaikoHitObject + { + protected override Judgement CreateJudgement() => new TaikoStrongHitJudgement(); + } +} diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs index f3dfb333b3..e0b229d96d 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs @@ -30,6 +30,14 @@ namespace osu.Game.Rulesets.Taiko.Objects /// public bool IsStrong; + protected override void CreateNestedHitObjects() + { + base.CreateNestedHitObjects(); + + if (IsStrong) + AddNested(new StrongHitObject()); + } + protected override Judgement CreateJudgement() => new TaikoJudgement(); protected override HitWindows CreateHitWindows() => new TaikoHitWindows(); From fdf889359f702a60870d6d4532a0e1b180e39447 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 3 Aug 2018 16:12:38 +0900 Subject: [PATCH 260/304] Migrate DrawableHit to use a nested hitobject for strong hits --- .../Objects/Drawables/DrawableCentreHit.cs | 2 +- .../Drawables/DrawableCentreHitStrong.cs | 26 ---- .../Objects/Drawables/DrawableHit.cs | 45 ++++--- .../Objects/Drawables/DrawableHitStrong.cs | 111 ------------------ .../Objects/Drawables/DrawableRimHit.cs | 2 +- .../Objects/Drawables/DrawableRimHitStrong.cs | 26 ---- .../Objects/Drawables/DrawableStrongHit.cs | 68 +++++++++++ .../Objects/TaikoHitObject.cs | 3 +- 8 files changed, 101 insertions(+), 182 deletions(-) delete mode 100644 osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs delete mode 100644 osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs delete mode 100644 osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHitStrong.cs create mode 100644 osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHit.cs diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHit.cs index dda96c2caf..a6e9972dd3 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHit.cs @@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableCentreHit : DrawableHit { - protected override TaikoAction[] HitActions { get; } = { TaikoAction.LeftCentre, TaikoAction.RightCentre }; + public override TaikoAction[] HitActions { get; } = { TaikoAction.LeftCentre, TaikoAction.RightCentre }; public DrawableCentreHit(Hit hit) : base(hit) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs deleted file mode 100644 index a2dabf2b18..0000000000 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs +++ /dev/null @@ -1,26 +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.Allocation; -using osu.Game.Graphics; -using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; - -namespace osu.Game.Rulesets.Taiko.Objects.Drawables -{ - public class DrawableCentreHitStrong : DrawableHitStrong - { - protected override TaikoAction[] HitActions { get; } = { TaikoAction.LeftCentre, TaikoAction.RightCentre }; - - public DrawableCentreHitStrong(Hit hit) - : base(hit) - { - MainPiece.Add(new CentreHitSymbolPiece()); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - MainPiece.AccentColour = colours.PinkDarker; - } - } -} diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 18177ad089..35fa5eb344 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -3,10 +3,8 @@ using System.Linq; using osu.Framework.Graphics; -using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; -using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Taiko.Objects.Drawables @@ -16,21 +14,19 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables /// /// A list of keys which can result in hits for this HitObject. /// - protected abstract TaikoAction[] HitActions { get; } - - protected readonly JudgementResult Result; + public abstract TaikoAction[] HitActions { get; } /// - /// Whether the last key pressed is a valid hit key. + /// The action that caused this to be hit. /// - private bool validKeyPressed; + public TaikoAction? HitAction { get; private set; } + + private bool validActionPressed; protected DrawableHit(Hit hit) : base(hit) { FillMode = FillMode.Fit; - - Result = Results.Single(r => !(r.Judgement is TaikoStrongHitJudgement)); } protected override void CheckForJudgements(bool userTriggered, double timeOffset) @@ -38,7 +34,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables if (!userTriggered) { if (!HitObject.HitWindows.CanBeHit(timeOffset)) - ApplyResult(Result, r => r.Type = HitResult.Miss); + ApplyResult(r => r.Type = HitResult.Miss); return; } @@ -46,18 +42,33 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables if (result == HitResult.None) return; - if (!validKeyPressed) - ApplyResult(Result, r => r.Type = HitResult.Miss); + if (!validActionPressed) + ApplyResult(r => r.Type = HitResult.Miss); else - ApplyResult(Result, r => r.Type = result); + ApplyResult(r => r.Type = result); } public override bool OnPressed(TaikoAction action) { - validKeyPressed = HitActions.Contains(action); + if (Judged) + return false; + + validActionPressed = HitActions.Contains(action); // Only count this as handled if the new judgement is a hit - return UpdateJudgement(true); + var result = UpdateJudgement(true); + + if (IsHit) + HitAction = action; + + return result; + } + + public override bool OnReleased(TaikoAction action) + { + if (action == HitAction) + HitAction = null; + return base.OnReleased(action); } protected override void Update() @@ -78,7 +89,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables switch (State.Value) { case ArmedState.Idle: - validKeyPressed = false; + validActionPressed = false; UnproxyContent(); this.Delay(HitObject.HitWindows.HalfWindowFor(HitResult.Miss)).Expire(); @@ -114,5 +125,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables } } } + + protected override DrawableStrongHitObject CreateStrongObject(StrongHitObject hitObject) => new DrawableStrongHit(hitObject, this); } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs deleted file mode 100644 index 7ec0c08f0f..0000000000 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using System.Linq; -using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Scoring; -using osu.Game.Rulesets.Taiko.Judgements; - -namespace osu.Game.Rulesets.Taiko.Objects.Drawables -{ - public abstract class DrawableHitStrong : DrawableHit - { - /// - /// The lenience for the second key press. - /// This does not adjust by map difficulty in ScoreV2 yet. - /// - private const double second_hit_window = 30; - - private readonly JudgementResult strongResult; - - private double firstHitTime; - private bool firstKeyHeld; - private TaikoAction firstHitAction; - - protected DrawableHitStrong(Hit hit) - : base(hit) - { - strongResult = Results.SingleOrDefault(r => r.Judgement is TaikoStrongHitJudgement); - } - - protected override void CheckForJudgements(bool userTriggered, double timeOffset) - { - if (!Result.HasResult) - { - base.CheckForJudgements(userTriggered, timeOffset); - return; - } - - if (!Result.IsHit) - { - ApplyResult(strongResult, r => r.Type = HitResult.Miss); - return; - } - - if (!userTriggered) - { - if (timeOffset > second_hit_window) - ApplyResult(strongResult, r => r.Type = HitResult.Miss); - return; - } - - if (Math.Abs(firstHitTime - Time.Current) < second_hit_window) - ApplyResult(strongResult, r => r.Type = HitResult.Great); - } - - protected override void UpdateState(ArmedState state) - { - base.UpdateState(state); - - switch (state) - { - case ArmedState.Idle: - firstHitTime = 0; - firstKeyHeld = false; - break; - } - } - - public override bool OnReleased(TaikoAction action) - { - if (action == firstHitAction) - firstKeyHeld = false; - return base.OnReleased(action); - } - - public override bool OnPressed(TaikoAction action) - { - if (AllJudged) - return false; - - // Check if we've handled the first key - if (!Result.HasResult) - { - // First key hasn't been handled yet, attempt to handle it - bool handled = base.OnPressed(action); - - if (handled) - { - firstHitTime = Time.Current; - firstHitAction = action; - firstKeyHeld = true; - } - - return handled; - } - - // Don't handle represses of the first key - if (firstHitAction == action) - return false; - - // Don't handle invalid hit action presses - if (!HitActions.Contains(action)) - return false; - - // Assume the intention was to hit the strong hit with both keys only if the first key is still being held down - return firstKeyHeld && UpdateJudgement(true); - } - } -} diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHit.cs index f2194c6d56..188cafe1db 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHit.cs @@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableRimHit : DrawableHit { - protected override TaikoAction[] HitActions { get; } = { TaikoAction.LeftRim, TaikoAction.RightRim }; + public override TaikoAction[] HitActions { get; } = { TaikoAction.LeftRim, TaikoAction.RightRim }; public DrawableRimHit(Hit hit) : base(hit) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHitStrong.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHitStrong.cs deleted file mode 100644 index 728fe416f7..0000000000 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHitStrong.cs +++ /dev/null @@ -1,26 +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.Allocation; -using osu.Game.Graphics; -using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; - -namespace osu.Game.Rulesets.Taiko.Objects.Drawables -{ - public class DrawableRimHitStrong : DrawableHitStrong - { - protected override TaikoAction[] HitActions { get; } = { TaikoAction.LeftRim, TaikoAction.RightRim }; - - public DrawableRimHitStrong(Hit hit) - : base(hit) - { - MainPiece.Add(new RimHitSymbolPiece()); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - MainPiece.AccentColour = colours.BlueDarker; - } - } -} diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHit.cs new file mode 100644 index 0000000000..c9767c9aec --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHit.cs @@ -0,0 +1,68 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Linq; +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Taiko.Objects.Drawables +{ + public class DrawableStrongHit : DrawableStrongHitObject + { + /// + /// The lenience for the second key press. + /// This does not adjust by map difficulty in ScoreV2 yet. + /// + private const double second_hit_window = 30; + + private readonly DrawableHit hit; + + public DrawableStrongHit(StrongHitObject strong, DrawableHit hit) + : base(strong) + { + this.hit = hit; + } + + protected override void CheckForJudgements(bool userTriggered, double timeOffset) + { + if (!hit.Result.HasResult) + { + base.CheckForJudgements(userTriggered, timeOffset); + return; + } + + if (!hit.Result.IsHit) + { + ApplyResult(r => r.Type = HitResult.Miss); + return; + } + + if (!userTriggered) + { + if (timeOffset > second_hit_window) + ApplyResult(r => r.Type = HitResult.Miss); + return; + } + + if (Math.Abs(hit.Result.TimeOffset - timeOffset) < second_hit_window) + ApplyResult(r => r.Type = HitResult.Great); + } + + public override bool OnPressed(TaikoAction action) + { + // Don't process actions until the main hitobject is hit + if (!hit.IsHit) + return false; + + // Don't process actions if the pressed button was released + if (hit.HitAction == null) + return false; + + // Don't handle invalid hit action presses + if (!hit.HitActions.Contains(action)) + return false; + + return UpdateJudgement(true); + } + } +} diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs index e0b229d96d..702b6d73b6 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs @@ -3,6 +3,7 @@ using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Taiko.Judgements; namespace osu.Game.Rulesets.Taiko.Objects @@ -35,7 +36,7 @@ namespace osu.Game.Rulesets.Taiko.Objects base.CreateNestedHitObjects(); if (IsStrong) - AddNested(new StrongHitObject()); + AddNested(new StrongHitObject { StartTime = (this as IHasEndTime)?.EndTime ?? StartTime }); } protected override Judgement CreateJudgement() => new TaikoJudgement(); From 449485344659d7fc12f52c046a34ce2e07da876f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 3 Aug 2018 16:20:08 +0900 Subject: [PATCH 261/304] Migrate DrawableDrumRoll to use a nested hitobject for strong hits --- .../Objects/Drawables/DrawableDrumRoll.cs | 21 +++----------- .../Drawables/DrawableStrongDrumRoll.cs | 28 +++++++++++++++++++ .../Drawables/DrawableStrongHitObject.cs | 1 + 3 files changed, 33 insertions(+), 17 deletions(-) create mode 100644 osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs index 93eaeb4a1f..da57f4ec4b 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -13,7 +13,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; -using osu.Game.Rulesets.Taiko.Judgements; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { @@ -24,9 +23,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables /// private const int rolling_hits_for_engaged_colour = 5; - private readonly JudgementResult result; - private readonly JudgementResult strongResult; - /// /// Rolling number of tick hits. This increases for hits and decreases for misses. /// @@ -48,9 +44,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables AddNested(newTick); tickContainer.Add(newTick); } - - result = Results.Single(r => !(r.Judgement is TaikoStrongHitJudgement)); - strongResult = Results.SingleOrDefault(r => r.Judgement is TaikoStrongHitJudgement); } protected override TaikoPiece CreateMainPiece() => new ElongatedCirclePiece(); @@ -90,17 +83,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables int countHit = NestedHitObjects.Count(o => o.IsHit); if (countHit >= HitObject.RequiredGoodHits) - { - ApplyResult(result, r => r.Type = countHit >= HitObject.RequiredGreatHits ? HitResult.Great : HitResult.Good); - if (HitObject.IsStrong) - ApplyResult(strongResult, r => r.Type = HitResult.Great); - } + ApplyResult(r => r.Type = countHit >= HitObject.RequiredGreatHits ? HitResult.Great : HitResult.Good); else - { - ApplyResult(result, r => r.Type = HitResult.Miss); - if (HitObject.IsStrong) - ApplyResult(strongResult, r => r.Type = HitResult.Miss); - } + ApplyResult(r => r.Type = HitResult.Miss); } protected override void UpdateState(ArmedState state) @@ -113,5 +98,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables break; } } + + protected override DrawableStrongHitObject CreateStrongObject(StrongHitObject hitObject) => new DrawableStrongDrumRoll(hitObject, this); } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs new file mode 100644 index 0000000000..c886f52397 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs @@ -0,0 +1,28 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Taiko.Objects.Drawables +{ + public class DrawableStrongDrumRoll : DrawableStrongHitObject + { + private readonly DrawableDrumRoll drumRoll; + + public DrawableStrongDrumRoll(StrongHitObject strong, DrawableDrumRoll drumRoll) + : base(strong) + { + this.drumRoll = drumRoll; + } + + protected override void CheckForJudgements(bool userTriggered, double timeOffset) + { + if (!drumRoll.Judged) + return; + + ApplyResult(r => r.Type = drumRoll.IsHit ? HitResult.Great : HitResult.Miss); + } + + public override bool OnPressed(TaikoAction action) => false; + } +} diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs index e9d12e9c35..5ff7d2b396 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs @@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected DrawableStrongHitObject(StrongHitObject strong) : base(strong) { + AlwaysPresent = true; } protected override void UpdateState(ArmedState state) From e8a140930e56357bd8648592ea7b22d52cf7bedc Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 3 Aug 2018 16:35:12 +0900 Subject: [PATCH 262/304] Migrate drum roll to use nested hitobjects for strong hits --- .../Objects/Drawables/DrawableDrumRollTick.cs | 22 +++------------ .../Drawables/DrawableStrongDrumRollTick.cs | 28 +++++++++++++++++++ 2 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRollTick.cs diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs index eeca1b1da3..458c4d7c80 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs @@ -2,28 +2,19 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Linq; using osu.Framework.Graphics; -using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; -using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableDrumRollTick : DrawableTaikoHitObject { - private readonly JudgementResult result; - private readonly JudgementResult strongResult; - public DrawableDrumRollTick(DrumRollTick tick) : base(tick) { FillMode = FillMode.Fit; - - result = Results.Single(r => !(r.Judgement is TaikoStrongHitJudgement)); - strongResult = Results.SingleOrDefault(r => r.Judgement is TaikoStrongHitJudgement); } public override bool DisplayJudgement => false; @@ -38,21 +29,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables if (!userTriggered) { if (timeOffset > HitObject.HitWindow) - { - ApplyResult(result, r => r.Type = HitResult.Miss); - if (HitObject.IsStrong) - ApplyResult(strongResult, r => r.Type = HitResult.Miss); - } - + ApplyResult(r => r.Type = HitResult.Miss); return; } if (Math.Abs(timeOffset) > HitObject.HitWindow) return; - ApplyResult(result, r => r.Type = HitResult.Great); - if (HitObject.IsStrong) - ApplyResult(strongResult, r => r.Type = HitResult.Great); + ApplyResult(r => r.Type = HitResult.Great); } protected override void UpdateState(ArmedState state) @@ -66,5 +50,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables } public override bool OnPressed(TaikoAction action) => UpdateJudgement(true); + + protected override DrawableStrongHitObject CreateStrongObject(StrongHitObject hitObject) => new DrawableStrongDrumRollTick(hitObject, this); } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRollTick.cs new file mode 100644 index 0000000000..6b821ead84 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRollTick.cs @@ -0,0 +1,28 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Taiko.Objects.Drawables +{ + public class DrawableStrongDrumRollTick : DrawableStrongHitObject + { + private readonly DrawableDrumRollTick tick; + + public DrawableStrongDrumRollTick(StrongHitObject strong, DrawableDrumRollTick tick) + : base(strong) + { + this.tick = tick; + } + + protected override void CheckForJudgements(bool userTriggered, double timeOffset) + { + if (!tick.Judged) + return; + + ApplyResult(r => r.Type = tick.IsHit ? HitResult.Great : HitResult.Miss); + } + + public override bool OnPressed(TaikoAction action) => false; + } +} From 19c541dbf51d27020697ce7de8e4cde64f1a0e8f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 3 Aug 2018 16:35:29 +0900 Subject: [PATCH 263/304] Migrate swells to use nested hitobjects for ticks --- .../Objects/Drawables/DrawableSwell.cs | 32 ++++++++++--------- .../Objects/Drawables/DrawableSwellTick.cs | 28 ++++++++++++++++ osu.Game.Rulesets.Taiko/Objects/Swell.cs | 8 +++++ osu.Game.Rulesets.Taiko/Objects/SwellTick.cs | 9 ++++++ .../UI/TaikoRulesetContainer.cs | 4 --- 5 files changed, 62 insertions(+), 19 deletions(-) create mode 100644 osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs create mode 100644 osu.Game.Rulesets.Taiko/Objects/SwellTick.cs diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 50b010e543..e6ef4c8a72 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -14,9 +14,7 @@ using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; -using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; -using osu.Game.Rulesets.Taiko.Judgements; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { @@ -32,8 +30,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private const float target_ring_scale = 5f; private const float inner_ring_alpha = 0.65f; - private readonly JudgementResult result; - private readonly List intermediateResults; + private readonly List ticks = new List(); private readonly Container bodyContainer; private readonly CircularContainer targetRing; @@ -113,8 +110,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables MainPiece.Add(symbol = new SwellSymbolPiece()); - result = Results.Single(r => !(r.Judgement is TaikoIntermediateSwellJudgement)); - intermediateResults = Results.Where(r => r.Judgement is TaikoIntermediateSwellJudgement).ToList(); + foreach (var tick in HitObject.NestedHitObjects.OfType()) + { + var vis = new DrawableSwellTick(tick); + + ticks.Add(vis); + AddInternal(vis); + AddNested(vis); + } } [BackgroundDependencyLoader] @@ -137,12 +140,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { if (userTriggered) { - var nextIntermediate = intermediateResults.FirstOrDefault(j => !j.HasResult); + var nextTick = ticks.FirstOrDefault(j => !j.IsHit); - if (nextIntermediate != null) - ApplyResult(nextIntermediate, r => r.Type = HitResult.Great); + nextTick?.TriggerResult(HitResult.Great); - var numHits = intermediateResults.Count(r => r.HasResult); + var numHits = ticks.Count(r => r.IsHit); var completion = (float)numHits / HitObject.RequiredHits; @@ -156,7 +158,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables expandingRing.ScaleTo(1f + Math.Min(target_ring_scale - 1f, (target_ring_scale - 1f) * completion * 1.3f), 260, Easing.OutQuint); if (numHits == HitObject.RequiredHits) - ApplyResult(result, r => r.Type = HitResult.Great); + ApplyResult(r => r.Type = HitResult.Great); } else { @@ -165,20 +167,20 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables int numHits = 0; - foreach (var intermediate in intermediateResults) + foreach (var tick in ticks) { - if (intermediate.HasResult) + if (tick.IsHit) { numHits++; continue; } - ApplyResult(intermediate, r => r.Type = HitResult.Miss); + tick.TriggerResult(HitResult.Miss); } var hitResult = numHits > HitObject.RequiredHits / 2 ? HitResult.Good : HitResult.Miss; - ApplyResult(result, r => r.Type = hitResult); + ApplyResult(r => r.Type = hitResult); } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs new file mode 100644 index 0000000000..813b6c965b --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs @@ -0,0 +1,28 @@ +// 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; +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Taiko.Objects.Drawables +{ + public class DrawableSwellTick : DrawableTaikoHitObject + { + public DrawableSwellTick(TaikoHitObject hitObject) + : base(hitObject) + { + } + + public void TriggerResult(HitResult type) => ApplyResult(r => r.Type = type); + + protected override void CheckForJudgements(bool userTriggered, double timeOffset) + { + } + + protected override void UpdateState(ArmedState state) + { + } + + public override bool OnPressed(TaikoAction action) => false; + } +} diff --git a/osu.Game.Rulesets.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs index eb6f931af4..c3ea71af3f 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Swell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs @@ -15,5 +15,13 @@ namespace osu.Game.Rulesets.Taiko.Objects /// The number of hits required to complete the swell successfully. /// public int RequiredHits = 10; + + protected override void CreateNestedHitObjects() + { + base.CreateNestedHitObjects(); + + for (int i = 0; i < RequiredHits; i++) + AddNested(new SwellTick()); + } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/SwellTick.cs b/osu.Game.Rulesets.Taiko/Objects/SwellTick.cs new file mode 100644 index 0000000000..49eb6d2a15 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Objects/SwellTick.cs @@ -0,0 +1,9 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Rulesets.Taiko.Objects +{ + public class SwellTick : TaikoHitObject + { + } +} diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs index 2fa4627bde..229ab69ceb 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs @@ -100,12 +100,8 @@ namespace osu.Game.Rulesets.Taiko.UI { switch (h) { - case CentreHit centreHit when h.IsStrong: - return new DrawableCentreHitStrong(centreHit); case CentreHit centreHit: return new DrawableCentreHit(centreHit); - case RimHit rimHit when h.IsStrong: - return new DrawableRimHitStrong(rimHit); case RimHit rimHit: return new DrawableRimHit(rimHit); case DrumRoll drumRoll: From b778a8d207ac1706bfc54a8d9acff8fccaab9ca3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 3 Aug 2018 16:35:53 +0900 Subject: [PATCH 264/304] Fix testcase --- .../TestCaseTaikoPlayfield.cs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs index ccae3cf3ce..18333e794e 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs @@ -8,7 +8,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; -using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Judgements; @@ -79,15 +78,12 @@ namespace osu.Game.Rulesets.Taiko.Tests ControlPointInfo = controlPointInfo }); - var rateAdjustClock = new StopwatchClock(true) { Rate = 1 }; - Add(playfieldContainer = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, Height = 768, - Clock = new FramedClock(rateAdjustClock), Children = new[] { rulesetContainer = new TaikoRulesetContainer(new TaikoRuleset(), beatmap) } }); } @@ -205,10 +201,7 @@ namespace osu.Game.Rulesets.Taiko.Tests h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); - if (strong) - rulesetContainer.Playfield.Add(new DrawableCentreHitStrong(h)); - else - rulesetContainer.Playfield.Add(new DrawableCentreHit(h)); + rulesetContainer.Playfield.Add(new DrawableCentreHit(h)); } private void addRimHit(bool strong) @@ -221,10 +214,7 @@ namespace osu.Game.Rulesets.Taiko.Tests h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); - if (strong) - rulesetContainer.Playfield.Add(new DrawableRimHitStrong(h)); - else - rulesetContainer.Playfield.Add(new DrawableRimHit(h)); + rulesetContainer.Playfield.Add(new DrawableRimHit(h)); } private class DrawableTestHit : DrawableHitObject From e6775c7a162fb9af7ba893b0aec85eba0e6a49e0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 3 Aug 2018 16:46:03 +0900 Subject: [PATCH 265/304] Fix playfield display --- .../Drawables/DrawableStrongDrumRoll.cs | 9 ++--- .../Drawables/DrawableStrongDrumRollTick.cs | 9 ++--- .../Objects/Drawables/DrawableStrongHit.cs | 17 ++++---- .../Drawables/DrawableStrongHitObject.cs | 6 ++- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 40 ++++++++++--------- 5 files changed, 40 insertions(+), 41 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs index c886f52397..3e8f5103c9 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs @@ -7,20 +7,17 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableStrongDrumRoll : DrawableStrongHitObject { - private readonly DrawableDrumRoll drumRoll; - public DrawableStrongDrumRoll(StrongHitObject strong, DrawableDrumRoll drumRoll) - : base(strong) + : base(strong, drumRoll) { - this.drumRoll = drumRoll; } protected override void CheckForJudgements(bool userTriggered, double timeOffset) { - if (!drumRoll.Judged) + if (!MainObject.Judged) return; - ApplyResult(r => r.Type = drumRoll.IsHit ? HitResult.Great : HitResult.Miss); + ApplyResult(r => r.Type = MainObject.IsHit ? HitResult.Great : HitResult.Miss); } public override bool OnPressed(TaikoAction action) => false; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRollTick.cs index 6b821ead84..1724054800 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRollTick.cs @@ -7,20 +7,17 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableStrongDrumRollTick : DrawableStrongHitObject { - private readonly DrawableDrumRollTick tick; - public DrawableStrongDrumRollTick(StrongHitObject strong, DrawableDrumRollTick tick) - : base(strong) + : base(strong, tick) { - this.tick = tick; } protected override void CheckForJudgements(bool userTriggered, double timeOffset) { - if (!tick.Judged) + if (!MainObject.Judged) return; - ApplyResult(r => r.Type = tick.IsHit ? HitResult.Great : HitResult.Miss); + ApplyResult(r => r.Type = MainObject.IsHit ? HitResult.Great : HitResult.Miss); } public override bool OnPressed(TaikoAction action) => false; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHit.cs index c9767c9aec..d0c6525cde 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHit.cs @@ -15,23 +15,22 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables /// private const double second_hit_window = 30; - private readonly DrawableHit hit; + public DrawableHit MainObject => (DrawableHit)base.MainObject; public DrawableStrongHit(StrongHitObject strong, DrawableHit hit) - : base(strong) + : base(strong, hit) { - this.hit = hit; } protected override void CheckForJudgements(bool userTriggered, double timeOffset) { - if (!hit.Result.HasResult) + if (!MainObject.Result.HasResult) { base.CheckForJudgements(userTriggered, timeOffset); return; } - if (!hit.Result.IsHit) + if (!MainObject.Result.IsHit) { ApplyResult(r => r.Type = HitResult.Miss); return; @@ -44,22 +43,22 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables return; } - if (Math.Abs(hit.Result.TimeOffset - timeOffset) < second_hit_window) + if (Math.Abs(MainObject.Result.TimeOffset - timeOffset) < second_hit_window) ApplyResult(r => r.Type = HitResult.Great); } public override bool OnPressed(TaikoAction action) { // Don't process actions until the main hitobject is hit - if (!hit.IsHit) + if (!MainObject.IsHit) return false; // Don't process actions if the pressed button was released - if (hit.HitAction == null) + if (MainObject.HitAction == null) return false; // Don't handle invalid hit action presses - if (!hit.HitActions.Contains(action)) + if (!MainObject.HitActions.Contains(action)) return false; return UpdateJudgement(true); diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs index 5ff7d2b396..85a1afd74b 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs @@ -7,9 +7,13 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public abstract class DrawableStrongHitObject : DrawableTaikoHitObject { - protected DrawableStrongHitObject(StrongHitObject strong) + public readonly DrawableHitObject MainObject; + + protected DrawableStrongHitObject(StrongHitObject strong, DrawableHitObject mainObject) : base(strong) { + MainObject = mainObject; + AlwaysPresent = true; } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 7147972c58..4a045ac86f 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -232,30 +232,32 @@ namespace osu.Game.Rulesets.Taiko.UI if (!judgedObject.DisplayJudgement) return; - if (judgementContainer.FirstOrDefault(j => j.JudgedObject == judgedObject) == null) + switch (result.Judgement) { - judgementContainer.Add(new DrawableTaikoJudgement(result, judgedObject) - { - Anchor = result.IsHit ? Anchor.TopLeft : Anchor.CentreLeft, - Origin = result.IsHit ? Anchor.BottomCentre : Anchor.Centre, - RelativePositionAxes = Axes.X, - X = result.IsHit ? judgedObject.Position.X : 0, - }); - } + case TaikoStrongHitJudgement _: + if (result.IsHit) + hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongHitObject)judgedObject).MainObject)?.VisualiseSecondHit(); + break; + default: + judgementContainer.Add(new DrawableTaikoJudgement(result, judgedObject) + { + Anchor = result.IsHit ? Anchor.TopLeft : Anchor.CentreLeft, + Origin = result.IsHit ? Anchor.BottomCentre : Anchor.Centre, + RelativePositionAxes = Axes.X, + X = result.IsHit ? judgedObject.Position.X : 0, + }); - if (!result.IsHit) - return; + if (!result.IsHit) + break; - bool isRim = judgedObject.HitObject is RimHit; + bool isRim = judgedObject.HitObject is RimHit; - if (result.Judgement is TaikoStrongHitJudgement) - hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == judgedObject)?.VisualiseSecondHit(); - else - { - hitExplosionContainer.Add(new HitExplosion(judgedObject, isRim)); + hitExplosionContainer.Add(new HitExplosion(judgedObject, isRim)); - if (judgedObject.HitObject.Kiai) - kiaiExplosionContainer.Add(new KiaiHitExplosion(judgedObject, isRim)); + if (judgedObject.HitObject.Kiai) + kiaiExplosionContainer.Add(new KiaiHitExplosion(judgedObject, isRim)); + + break; } } } From 412e4ff681fa7b9ffefaea753b0f736260091ea9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 3 Aug 2018 16:49:24 +0900 Subject: [PATCH 266/304] Fix display of swells --- .../Objects/Drawables/DrawableStrongHitObject.cs | 2 ++ osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs | 5 ----- .../Objects/Drawables/DrawableSwellTick.cs | 2 ++ 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs index 85a1afd74b..3f6080d1b5 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs @@ -7,6 +7,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public abstract class DrawableStrongHitObject : DrawableTaikoHitObject { + public override bool DisplayJudgement => false; + public readonly DrawableHitObject MainObject; protected DrawableStrongHitObject(StrongHitObject strong, DrawableHitObject mainObject) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index e6ef4c8a72..24b1a0e9da 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -20,11 +20,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableSwell : DrawableTaikoHitObject { - /// - /// A judgement is only displayed when the user has complete the swell (either a hit or miss). - /// - public override bool DisplayJudgement => AllJudged; - private const float target_ring_thick_border = 1.4f; private const float target_ring_thin_border = 1f; private const float target_ring_scale = 5f; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs index 813b6c965b..8266d329a2 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs @@ -8,6 +8,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableSwellTick : DrawableTaikoHitObject { + public override bool DisplayJudgement => false; + public DrawableSwellTick(TaikoHitObject hitObject) : base(hitObject) { From 38263714a13761011ff6f7cbc7cd75446f8587b8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 3 Aug 2018 16:56:46 +0900 Subject: [PATCH 267/304] Cleanups --- .../TestCaseTaikoPlayfield.cs | 2 +- ...itJudgement.cs => TaikoStrongJudgement.cs} | 2 +- .../Objects/Drawables/DrawableDrumRoll.cs | 20 +++++- .../Objects/Drawables/DrawableDrumRollTick.cs | 20 +++++- .../Objects/Drawables/DrawableHit.cs | 61 ++++++++++++++++- .../Drawables/DrawableStrongDrumRoll.cs | 25 ------- .../Drawables/DrawableStrongDrumRollTick.cs | 25 ------- ...gHitObject.cs => DrawableStrongHandler.cs} | 8 ++- .../Objects/Drawables/DrawableStrongHit.cs | 67 ------------------- .../Drawables/DrawableTaikoHitObject.cs | 10 ++- .../Objects/StrongHitObject.cs | 2 +- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 4 +- 12 files changed, 117 insertions(+), 129 deletions(-) rename osu.Game.Rulesets.Taiko/Judgements/{TaikoStrongHitJudgement.cs => TaikoStrongJudgement.cs} (82%) delete mode 100644 osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs delete mode 100644 osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRollTick.cs rename osu.Game.Rulesets.Taiko/Objects/Drawables/{DrawableStrongHitObject.cs => DrawableStrongHandler.cs} (60%) delete mode 100644 osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHit.cs diff --git a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs index 18333e794e..35cb94e8de 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs @@ -145,7 +145,7 @@ namespace osu.Game.Rulesets.Taiko.Tests if (RNG.Next(10) == 0) { ((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult }); - ((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new JudgementResult(new TaikoStrongHitJudgement()) { Type = HitResult.Great }); + ((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new JudgementResult(new TaikoStrongJudgement()) { Type = HitResult.Great }); } } diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongJudgement.cs similarity index 82% rename from osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs rename to osu.Game.Rulesets.Taiko/Judgements/TaikoStrongJudgement.cs index b69bbd4fd8..ccfdeb5b0e 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongJudgement.cs @@ -3,7 +3,7 @@ namespace osu.Game.Rulesets.Taiko.Judgements { - public class TaikoStrongHitJudgement : TaikoJudgement + public class TaikoStrongJudgement : TaikoJudgement { public override bool AffectsCombo => false; } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs index da57f4ec4b..a984af3b51 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -99,6 +99,24 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables } } - protected override DrawableStrongHitObject CreateStrongObject(StrongHitObject hitObject) => new DrawableStrongDrumRoll(hitObject, this); + protected override DrawableStrongHandler CreateStrongHandler(StrongHitObject hitObject) => new StrongHandler(hitObject, this); + + private class StrongHandler : DrawableStrongHandler + { + public StrongHandler(StrongHitObject strong, DrawableDrumRoll drumRoll) + : base(strong, drumRoll) + { + } + + protected override void CheckForJudgements(bool userTriggered, double timeOffset) + { + if (!MainObject.Judged) + return; + + ApplyResult(r => r.Type = MainObject.IsHit ? HitResult.Great : HitResult.Miss); + } + + public override bool OnPressed(TaikoAction action) => false; + } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs index 458c4d7c80..cbe6e10dcb 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs @@ -51,6 +51,24 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables public override bool OnPressed(TaikoAction action) => UpdateJudgement(true); - protected override DrawableStrongHitObject CreateStrongObject(StrongHitObject hitObject) => new DrawableStrongDrumRollTick(hitObject, this); + protected override DrawableStrongHandler CreateStrongHandler(StrongHitObject hitObject) => new StrongHandler(hitObject, this); + + private class StrongHandler : DrawableStrongHandler + { + public StrongHandler(StrongHitObject strong, DrawableDrumRollTick tick) + : base(strong, tick) + { + } + + protected override void CheckForJudgements(bool userTriggered, double timeOffset) + { + if (!MainObject.Judged) + return; + + ApplyResult(r => r.Type = MainObject.IsHit ? HitResult.Great : HitResult.Miss); + } + + public override bool OnPressed(TaikoAction action) => false; + } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 35fa5eb344..4289a77f4c 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.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.Linq; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; @@ -126,6 +127,64 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables } } - protected override DrawableStrongHitObject CreateStrongObject(StrongHitObject hitObject) => new DrawableStrongHit(hitObject, this); + protected override DrawableStrongHandler CreateStrongHandler(StrongHitObject hitObject) => new StrongHandler(hitObject, this); + + private class StrongHandler : DrawableStrongHandler + { + /// + /// The lenience for the second key press. + /// This does not adjust by map difficulty in ScoreV2 yet. + /// + private const double second_hit_window = 30; + + public new DrawableHit MainObject => (DrawableHit)base.MainObject; + + public StrongHandler(StrongHitObject strong, DrawableHit hit) + : base(strong, hit) + { + } + + protected override void CheckForJudgements(bool userTriggered, double timeOffset) + { + if (!MainObject.Result.HasResult) + { + base.CheckForJudgements(userTriggered, timeOffset); + return; + } + + if (!MainObject.Result.IsHit) + { + ApplyResult(r => r.Type = HitResult.Miss); + return; + } + + if (!userTriggered) + { + if (timeOffset > second_hit_window) + ApplyResult(r => r.Type = HitResult.Miss); + return; + } + + if (Math.Abs(MainObject.Result.TimeOffset - timeOffset) < second_hit_window) + ApplyResult(r => r.Type = HitResult.Great); + } + + public override bool OnPressed(TaikoAction action) + { + // Don't process actions until the main hitobject is hit + if (!MainObject.IsHit) + return false; + + // Don't process actions if the pressed button was released + if (MainObject.HitAction == null) + return false; + + // Don't handle invalid hit action presses + if (!MainObject.HitActions.Contains(action)) + return false; + + return UpdateJudgement(true); + } + } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs deleted file mode 100644 index 3e8f5103c9..0000000000 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs +++ /dev/null @@ -1,25 +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.Scoring; - -namespace osu.Game.Rulesets.Taiko.Objects.Drawables -{ - public class DrawableStrongDrumRoll : DrawableStrongHitObject - { - public DrawableStrongDrumRoll(StrongHitObject strong, DrawableDrumRoll drumRoll) - : base(strong, drumRoll) - { - } - - protected override void CheckForJudgements(bool userTriggered, double timeOffset) - { - if (!MainObject.Judged) - return; - - ApplyResult(r => r.Type = MainObject.IsHit ? HitResult.Great : HitResult.Miss); - } - - public override bool OnPressed(TaikoAction action) => false; - } -} diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRollTick.cs deleted file mode 100644 index 1724054800..0000000000 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongDrumRollTick.cs +++ /dev/null @@ -1,25 +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.Scoring; - -namespace osu.Game.Rulesets.Taiko.Objects.Drawables -{ - public class DrawableStrongDrumRollTick : DrawableStrongHitObject - { - public DrawableStrongDrumRollTick(StrongHitObject strong, DrawableDrumRollTick tick) - : base(strong, tick) - { - } - - protected override void CheckForJudgements(bool userTriggered, double timeOffset) - { - if (!MainObject.Judged) - return; - - ApplyResult(r => r.Type = MainObject.IsHit ? HitResult.Great : HitResult.Miss); - } - - public override bool OnPressed(TaikoAction action) => false; - } -} diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs similarity index 60% rename from osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs index 3f6080d1b5..6f2db764a8 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs @@ -2,16 +2,20 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Taiko.Judgements; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { - public abstract class DrawableStrongHitObject : DrawableTaikoHitObject + /// + /// Used as a nested hitobject to provide s for s. + /// + public abstract class DrawableStrongHandler : DrawableTaikoHitObject { public override bool DisplayJudgement => false; public readonly DrawableHitObject MainObject; - protected DrawableStrongHitObject(StrongHitObject strong, DrawableHitObject mainObject) + protected DrawableStrongHandler(StrongHitObject strong, DrawableHitObject mainObject) : base(strong) { MainObject = mainObject; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHit.cs deleted file mode 100644 index d0c6525cde..0000000000 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHit.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using System.Linq; -using osu.Game.Rulesets.Scoring; - -namespace osu.Game.Rulesets.Taiko.Objects.Drawables -{ - public class DrawableStrongHit : DrawableStrongHitObject - { - /// - /// The lenience for the second key press. - /// This does not adjust by map difficulty in ScoreV2 yet. - /// - private const double second_hit_window = 30; - - public DrawableHit MainObject => (DrawableHit)base.MainObject; - - public DrawableStrongHit(StrongHitObject strong, DrawableHit hit) - : base(strong, hit) - { - } - - protected override void CheckForJudgements(bool userTriggered, double timeOffset) - { - if (!MainObject.Result.HasResult) - { - base.CheckForJudgements(userTriggered, timeOffset); - return; - } - - if (!MainObject.Result.IsHit) - { - ApplyResult(r => r.Type = HitResult.Miss); - return; - } - - if (!userTriggered) - { - if (timeOffset > second_hit_window) - ApplyResult(r => r.Type = HitResult.Miss); - return; - } - - if (Math.Abs(MainObject.Result.TimeOffset - timeOffset) < second_hit_window) - ApplyResult(r => r.Type = HitResult.Great); - } - - public override bool OnPressed(TaikoAction action) - { - // Don't process actions until the main hitobject is hit - if (!MainObject.IsHit) - return false; - - // Don't process actions if the pressed button was released - if (MainObject.HitAction == null) - return false; - - // Don't handle invalid hit action presses - if (!MainObject.HitActions.Contains(action)) - return false; - - return UpdateJudgement(true); - } - } -} diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index b0216768c1..6d19c99b9c 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -105,7 +105,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables var strongObject = HitObject.NestedHitObjects.OfType().FirstOrDefault(); if (strongObject != null) { - var vis = CreateStrongObject(strongObject); + var vis = CreateStrongHandler(strongObject); if (vis != null) { AddNested(vis); @@ -121,6 +121,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected virtual TaikoPiece CreateMainPiece() => new CirclePiece(); - protected virtual DrawableStrongHitObject CreateStrongObject(StrongHitObject hitObject) => null; + /// + /// Creates the handler for this 's . + /// This is only invoked if is true for . + /// + /// The strong hitobject. + /// The strong hitobject handler. + protected virtual DrawableStrongHandler CreateStrongHandler(StrongHitObject hitObject) => null; } } diff --git a/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs index 104d662ed8..a9d452cc68 100644 --- a/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs @@ -8,6 +8,6 @@ namespace osu.Game.Rulesets.Taiko.Objects { public class StrongHitObject : TaikoHitObject { - protected override Judgement CreateJudgement() => new TaikoStrongHitJudgement(); + protected override Judgement CreateJudgement() => new TaikoStrongJudgement(); } } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 4a045ac86f..5202fe00ad 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -234,9 +234,9 @@ namespace osu.Game.Rulesets.Taiko.UI switch (result.Judgement) { - case TaikoStrongHitJudgement _: + case TaikoStrongJudgement _: if (result.IsHit) - hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongHitObject)judgedObject).MainObject)?.VisualiseSecondHit(); + hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongHandler)judgedObject).MainObject)?.VisualiseSecondHit(); break; default: judgementContainer.Add(new DrawableTaikoJudgement(result, judgedObject) From 4c57e629ffe0905e90cb524d59fc3e714b7eb556 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Aug 2018 19:32:34 +0900 Subject: [PATCH 268/304] Use private implementation --- osu.Game/Overlays/Chat/DrawableChannel.cs | 8 ++++---- osu.Game/Overlays/ChatOverlay.cs | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index acc145af68..4586d4d87c 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Chat protected override void LoadComplete() { base.LoadComplete(); - ScrollToEnd(); + scrollToEnd(); } protected override void Dispose(bool isDisposing) @@ -85,8 +85,8 @@ namespace osu.Game.Overlays.Chat if (!IsLoaded) return; - if (scroll.IsScrolledToEnd(10) || !flow.Children.Any()) - ScrollToEnd(); + if (scroll.IsScrolledToEnd(10) || !flow.Children.Any() || newMessages.Any(m => m.GetType() == typeof(LocalEchoMessage))) + scrollToEnd(); var staleMessages = flow.Children.Where(c => c.LifetimeEnd == double.MaxValue).ToArray(); int count = staleMessages.Length - Channel.MAX_HISTORY; @@ -118,7 +118,7 @@ namespace osu.Game.Overlays.Chat flow.Children.FirstOrDefault(c => c.Message == removed)?.FadeColour(Color4.Red, 400).FadeOut(600).Expire(); } - public void ScrollToEnd() => ScheduleAfterChildren(() => scroll.ScrollToEnd()); + private void scrollToEnd() => ScheduleAfterChildren(() => scroll.ScrollToEnd()); private class ChatLineContainer : FillFlowContainer { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index f86c5204bb..8e20d76914 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -475,8 +475,6 @@ namespace osu.Game.Overlays if (target == null) return; - currentChannelContainer.Child.ScrollToEnd(); - if (!api.IsLoggedIn) { target.AddNewMessages(new ErrorMessage("Please sign in to participate in chat!")); From b4ef3dd4dd970e55a7c29c02d6903751762d1507 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Aug 2018 20:02:12 +0900 Subject: [PATCH 269/304] Add LocalMessage --- osu.Game/Online/Chat/InfoMessage.cs | 2 +- osu.Game/Online/Chat/LocalEchoMessage.cs | 2 +- osu.Game/Online/Chat/LocalMessage.cs | 16 ++++++++++++++++ osu.Game/Overlays/Chat/DrawableChannel.cs | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 osu.Game/Online/Chat/LocalMessage.cs diff --git a/osu.Game/Online/Chat/InfoMessage.cs b/osu.Game/Online/Chat/InfoMessage.cs index 2be025e403..2ff901deb1 100644 --- a/osu.Game/Online/Chat/InfoMessage.cs +++ b/osu.Game/Online/Chat/InfoMessage.cs @@ -6,7 +6,7 @@ using osu.Game.Users; namespace osu.Game.Online.Chat { - public class InfoMessage : Message + public class InfoMessage : LocalMessage { private static int infoID = -1; diff --git a/osu.Game/Online/Chat/LocalEchoMessage.cs b/osu.Game/Online/Chat/LocalEchoMessage.cs index 2e90b9d3fd..7d678029aa 100644 --- a/osu.Game/Online/Chat/LocalEchoMessage.cs +++ b/osu.Game/Online/Chat/LocalEchoMessage.cs @@ -3,7 +3,7 @@ namespace osu.Game.Online.Chat { - public class LocalEchoMessage : Message + public class LocalEchoMessage : LocalMessage { public LocalEchoMessage() : base(null) { diff --git a/osu.Game/Online/Chat/LocalMessage.cs b/osu.Game/Online/Chat/LocalMessage.cs new file mode 100644 index 0000000000..93f1e7f9ea --- /dev/null +++ b/osu.Game/Online/Chat/LocalMessage.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Online.Chat +{ + /// + /// A message which is generated and displayed locally. + /// + public class LocalMessage : Message + { + protected LocalMessage(long? id) + : base(id) + { + } + } +} diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index 4586d4d87c..c57e71b5ad 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -85,7 +85,7 @@ namespace osu.Game.Overlays.Chat if (!IsLoaded) return; - if (scroll.IsScrolledToEnd(10) || !flow.Children.Any() || newMessages.Any(m => m.GetType() == typeof(LocalEchoMessage))) + if (scroll.IsScrolledToEnd(10) || !flow.Children.Any() || newMessages.Any(m => m is LocalMessage)) scrollToEnd(); var staleMessages = flow.Children.Where(c => c.LifetimeEnd == double.MaxValue).ToArray(); From 8d98826f69b6dd0226e0b8919bffe10716393679 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Aug 2018 21:17:17 +0900 Subject: [PATCH 270/304] 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 89e80bd06b..1fed7f46bc 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 6d6fea47ab32c6dafbeb909189df9846741dce10 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 5 Aug 2018 14:36:09 +0900 Subject: [PATCH 271/304] Reduce animations of osu!direct list mode The panels' content was flying around and felt really shocking. This fixes elements in place to provide a better experience. --- osu.Game/Overlays/Direct/DirectListPanel.cs | 77 +++++++++++---------- osu.Game/Overlays/Direct/DirectPanel.cs | 5 +- 2 files changed, 43 insertions(+), 39 deletions(-) diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 45e1164a57..850ead37f6 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -12,7 +12,6 @@ using osu.Game.Graphics.Sprites; using osu.Framework.Allocation; using osu.Framework.Localisation; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; using osu.Game.Beatmaps; namespace osu.Game.Overlays.Direct @@ -26,12 +25,14 @@ namespace osu.Game.Overlays.Direct private PlayButton playButton; private Box progressBar; - private Container downloadContainer; + + protected override bool FadePlayButton => false; protected override PlayButton PlayButton => playButton; protected override Box PreviewBar => progressBar; - public DirectListPanel(BeatmapSetInfo beatmap) : base(beatmap) + public DirectListPanel(BeatmapSetInfo beatmap) + : base(beatmap) { RelativeSizeAxes = Axes.X; Height = height; @@ -66,30 +67,45 @@ namespace osu.Game.Overlays.Direct Spacing = new Vector2(10, 0), Children = new Drawable[] { - playButton = new PlayButton(SetInfo) - { - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, - Size = new Vector2(height / 2), - FillMode = FillMode.Fit, - Alpha = 0, - }, new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { - new OsuSpriteText + new FillFlowContainer { - Current = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title), - TextSize = 18, - Font = @"Exo2.0-BoldItalic", - }, - new OsuSpriteText - { - Current = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist), - Font = @"Exo2.0-BoldItalic", + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + playButton = new PlayButton(SetInfo) + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + Size = new Vector2(height / 2), + FillMode = FillMode.Fit, + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new OsuSpriteText + { + Current = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title), + TextSize = 18, + Font = @"Exo2.0-BoldItalic", + }, + new OsuSpriteText + { + Current = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist), + Font = @"Exo2.0-BoldItalic", + }, + } + }, + } }, new FillFlowContainer { @@ -108,16 +124,13 @@ namespace osu.Game.Overlays.Direct Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, - LayoutEasing = Easing.OutQuint, - LayoutDuration = transition_duration, Children = new Drawable[] { - downloadContainer = new Container + new Container { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, AutoSizeAxes = Axes.Both, - Alpha = 0, Child = new DownloadButton(SetInfo) { Size = new Vector2(height - vertical_padding * 3), @@ -184,17 +197,5 @@ namespace osu.Game.Overlays.Direct }, }); } - - protected override bool OnHover(InputState state) - { - downloadContainer.FadeIn(transition_duration, Easing.InOutQuint); - return base.OnHover(state); - } - - protected override void OnHoverLost(InputState state) - { - downloadContainer.FadeOut(transition_duration, Easing.InOutQuint); - base.OnHoverLost(state); - } } } diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 7d5c0c16cc..5a73aab23e 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -40,6 +40,8 @@ namespace osu.Game.Overlays.Direct protected abstract PlayButton PlayButton { get; } protected abstract Box PreviewBar { get; } + protected virtual bool FadePlayButton => true; + protected override Container Content => content; protected DirectPanel(BeatmapSetInfo setInfo) @@ -125,6 +127,7 @@ namespace osu.Game.Overlays.Direct { content.TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint); content.MoveToY(-4, hover_transition_time, Easing.OutQuint); + if (FadePlayButton) PlayButton.FadeIn(120, Easing.InOutQuint); return base.OnHover(state); @@ -134,7 +137,7 @@ namespace osu.Game.Overlays.Direct { content.TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint); content.MoveToY(0, hover_transition_time, Easing.OutQuint); - if (!PreviewPlaying) + if (FadePlayButton && !PreviewPlaying) PlayButton.FadeOut(120, Easing.InOutQuint); base.OnHoverLost(state); From 5fd4ed2f4e67f81b21d5fb628df609b5e71721d1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Aug 2018 10:54:16 +0900 Subject: [PATCH 272/304] Rename judgement-related methods/events + commenting --- .../Scoring/CatchScoreProcessor.cs | 4 +- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 4 +- .../Scoring/ManiaScoreProcessor.cs | 4 +- osu.Game.Rulesets.Mania/UI/Column.cs | 4 +- osu.Game.Rulesets.Mania/UI/ManiaStage.cs | 4 +- osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs | 4 +- .../Scoring/OsuScoreProcessor.cs | 4 +- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 4 +- .../TestCaseTaikoPlayfield.cs | 8 ++-- .../Objects/Drawables/DrawableDrumRoll.cs | 4 +- .../Scoring/TaikoScoreProcessor.cs | 4 +- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 4 +- .../Objects/Drawables/DrawableHitObject.cs | 19 +++++--- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 45 ++++++++++++------- osu.Game/Rulesets/UI/RulesetContainer.cs | 15 +++++-- 15 files changed, 78 insertions(+), 53 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs index 183c6f0f12..403cedde8c 100644 --- a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs @@ -29,9 +29,9 @@ namespace osu.Game.Rulesets.Catch.Scoring private const double harshness = 0.01; - protected override void OnNewJudgement(JudgementResult result) + protected override void ApplyResult(JudgementResult result) { - base.OnNewJudgement(result); + base.ApplyResult(result); if (result.Type == HitResult.Miss) { diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 7b52066d15..ffb93fd679 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Catch.UI public override void Add(DrawableHitObject h) { - h.OnJudgement += onJudgement; + h.OnNewResult += onNewResult; base.Add(h); @@ -67,7 +67,7 @@ namespace osu.Game.Rulesets.Catch.UI fruit.CheckPosition = CheckIfWeCanCatch; } - private void onJudgement(DrawableHitObject judgedObject, JudgementResult result) + private void onNewResult(DrawableHitObject judgedObject, JudgementResult result) => catcherArea.OnJudgement((DrawableCatchHitObject)judgedObject, result); } } diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index 289bcc3d34..12b32c46ee 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -121,9 +121,9 @@ namespace osu.Game.Rulesets.Mania.Scoring } } - protected override void OnNewJudgement(JudgementResult result) + protected override void ApplyResult(JudgementResult result) { - base.OnNewJudgement(result); + base.ApplyResult(result); bool isTick = result.Judgement is HoldNoteTickJudgement; diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index ca7173ec50..500f999dd6 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -131,12 +131,12 @@ namespace osu.Game.Rulesets.Mania.UI public override void Add(DrawableHitObject hitObject) { hitObject.AccentColour = AccentColour; - hitObject.OnJudgement += OnJudgement; + hitObject.OnNewResult += OnNewResult; HitObjects.Add(hitObject); } - internal void OnJudgement(DrawableHitObject judgedObject, JudgementResult result) + internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result) { if (!result.IsHit || !judgedObject.DisplayJudgement || !DisplayJudgements) return; diff --git a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs index 9072e044bd..f5993e61de 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs @@ -156,12 +156,12 @@ namespace osu.Game.Rulesets.Mania.UI var maniaObject = (ManiaHitObject)h.HitObject; int columnIndex = maniaObject.Column - firstColumnIndex; Columns.ElementAt(columnIndex).Add(h); - h.OnJudgement += OnJudgement; + h.OnNewResult += OnNewResult; } public void Add(BarLine barline) => base.Add(new DrawableBarLine(barline)); - internal void OnJudgement(DrawableHitObject judgedObject, JudgementResult result) + internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result) { if (!judgedObject.DisplayJudgement || !DisplayJudgements) return; diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs index 2da4d8265d..3f9464a98f 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs @@ -304,13 +304,13 @@ namespace osu.Game.Rulesets.Osu.Tests foreach (var mod in Mods.OfType()) mod.ApplyToDrawableHitObjects(new[] { drawable }); - drawable.OnJudgement += onJudgement; + drawable.OnNewResult += onNewResult; Add(drawable); } private float judgementOffsetDirection = 1; - private void onJudgement(DrawableHitObject judgedObject, JudgementResult result) + private void onNewResult(DrawableHitObject judgedObject, JudgementResult result) { var osuObject = judgedObject as DrawableOsuHitObject; if (osuObject == null) diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index 2986b4b5dc..d935c28365 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -51,9 +51,9 @@ namespace osu.Game.Rulesets.Osu.Scoring private const double harshness = 0.01; - protected override void OnNewJudgement(JudgementResult result) + protected override void ApplyResult(JudgementResult result) { - base.OnNewJudgement(result); + base.ApplyResult(result); var osuResult = (OsuJudgementResult)result; diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 8a898fb5e2..989b1ed964 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.UI public override void Add(DrawableHitObject h) { - h.OnJudgement += onJudgement; + h.OnNewResult += onNewResult; var c = h as IDrawableHitObjectWithProxiedApproach; if (c != null) @@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Osu.UI connectionLayer.HitObjects = HitObjects.Objects.Select(d => d.HitObject).OfType(); } - private void onJudgement(DrawableHitObject judgedObject, JudgementResult result) + private void onNewResult(DrawableHitObject judgedObject, JudgementResult result) { if (!judgedObject.DisplayJudgement || !DisplayJudgements) return; diff --git a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs index 35cb94e8de..23c57e0767 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs @@ -140,18 +140,18 @@ namespace osu.Game.Rulesets.Taiko.Tests var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) }; - ((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult }); + ((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult }); if (RNG.Next(10) == 0) { - ((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult }); - ((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new JudgementResult(new TaikoStrongJudgement()) { Type = HitResult.Great }); + ((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult }); + ((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(h, new JudgementResult(new TaikoStrongJudgement()) { Type = HitResult.Great }); } } private void addMissJudgement() { - ((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(new DrawableTestHit(new Hit()), new JudgementResult(new TaikoJudgement()) { Type = HitResult.Miss }); + ((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(new DrawableTestHit(new Hit()), new JudgementResult(new TaikoJudgement()) { Type = HitResult.Miss }); } private void addBarLine(bool major, double delay = scroll_time) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs index a984af3b51..18669cec2b 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables foreach (var tick in drumRoll.NestedHitObjects.OfType()) { var newTick = new DrawableDrumRollTick(tick); - newTick.OnJudgement += onTickJudgement; + newTick.OnNewResult += onNewTickResult; AddNested(newTick); tickContainer.Add(newTick); @@ -60,7 +60,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables colourEngaged = colours.YellowDarker; } - private void onTickJudgement(DrawableHitObject obj, JudgementResult result) + private void onNewTickResult(DrawableHitObject obj, JudgementResult result) { if (result.Type > HitResult.Miss) rollingHits++; diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index f5c5fcbe9c..cf33141027 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -76,9 +76,9 @@ namespace osu.Game.Rulesets.Taiko.Scoring hpIncreaseMiss = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, hp_miss_min, hp_miss_mid, hp_miss_max); } - protected override void OnNewJudgement(JudgementResult result) + protected override void ApplyResult(JudgementResult result) { - base.OnNewJudgement(result); + base.ApplyResult(result); bool isTick = result.Judgement is TaikoDrumRollTickJudgement; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 5202fe00ad..8078f648e8 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -209,7 +209,7 @@ namespace osu.Game.Rulesets.Taiko.UI public override void Add(DrawableHitObject h) { - h.OnJudgement += OnJudgement; + h.OnNewResult += OnNewResult; base.Add(h); @@ -224,7 +224,7 @@ namespace osu.Game.Rulesets.Taiko.UI } } - internal void OnJudgement(DrawableHitObject judgedObject, JudgementResult result) + internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result) { if (!DisplayJudgements) return; diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index a22a7a616b..0bc7a160ce 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -35,8 +35,15 @@ namespace osu.Game.Rulesets.Objects.Drawables private readonly Lazy> nestedHitObjects = new Lazy>(); public IEnumerable NestedHitObjects => nestedHitObjects.IsValueCreated ? nestedHitObjects.Value : Enumerable.Empty(); - public event Action OnJudgement; - public event Action OnJudgementRemoved; + /// + /// Invoked when a has been applied by this or a nested . + /// + public event Action OnNewResult; + + /// + /// Invoked when a has been reset by this or a nested . + /// + public event Action OnResultReset; /// /// Whether a visible judgement should be displayed when this representation is hit. @@ -143,7 +150,7 @@ namespace osu.Game.Rulesets.Objects.Drawables if (Result.TimeOffset + endTime < Time.Current) { - OnJudgementRemoved?.Invoke(this, Result); + OnResultReset?.Invoke(this, Result); Result.Type = HitResult.None; State.Value = ArmedState.Idle; @@ -162,8 +169,8 @@ namespace osu.Game.Rulesets.Objects.Drawables protected virtual void AddNested(DrawableHitObject h) { - h.OnJudgement += (d, r) => OnJudgement?.Invoke(d, r); - h.OnJudgementRemoved += (d, r) => OnJudgementRemoved?.Invoke(d, r); + h.OnNewResult += (d, r) => OnNewResult?.Invoke(d, r); + h.OnResultReset += (d, r) => OnResultReset?.Invoke(d, r); h.ApplyCustomUpdateState += (d, j) => ApplyCustomUpdateState?.Invoke(d, j); nestedHitObjects.Value.Add(h); @@ -195,7 +202,7 @@ namespace osu.Game.Rulesets.Objects.Drawables break; } - OnJudgement?.Invoke(this, Result); + OnNewResult?.Invoke(this, Result); } /// diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 985cfce6aa..b727a0d685 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -195,8 +195,8 @@ namespace osu.Game.Rulesets.Scoring { Debug.Assert(base_portion + combo_portion == 1.0); - rulesetContainer.OnJudgement += AddJudgement; - rulesetContainer.OnJudgementRemoved += RemoveJudgement; + rulesetContainer.OnNewResult += applyResult; + rulesetContainer.OnResultReset += resetResult; SimulateAutoplay(rulesetContainer.Beatmap); Reset(true); @@ -210,10 +210,19 @@ namespace osu.Game.Rulesets.Scoring Mode.ValueChanged += _ => updateScore(); } + /// + /// Applies any properties of the which affect scoring to this . + /// + /// The to read properties from. protected virtual void ApplyBeatmap(Beatmap beatmap) { } + /// + /// Simulates an autoplay of the to determine scoring values. + /// + /// This provided temporarily. DO NOT USE. + /// The to simulate. protected virtual void SimulateAutoplay(Beatmap beatmap) { foreach (var obj in beatmap.HitObjects) @@ -230,18 +239,17 @@ namespace osu.Game.Rulesets.Scoring var result = CreateJudgementResult(obj.Judgement); result.Type = obj.Judgement.MaxResult; - AddJudgement(result); + applyResult(result); } } /// - /// Adds a judgement to this ScoreProcessor. + /// Applies the score change of a to this . /// - /// The judgement to add. - /// The judgement scoring result. - protected void AddJudgement(JudgementResult result) + /// The to apply. + private void applyResult(JudgementResult result) { - OnNewJudgement(result); + ApplyResult(result); updateScore(); UpdateFailed(); @@ -249,22 +257,21 @@ namespace osu.Game.Rulesets.Scoring } /// - /// Removes a judgement from this ScoreProcessor. + /// Resets the score change of a that was applied to this . /// /// The judgement to remove. /// The judgement scoring result. - protected void RemoveJudgement(JudgementResult result) + private void resetResult(JudgementResult result) { - OnJudgementRemoved(result); + ResetResult(result); updateScore(); } /// - /// Applies a judgement. + /// Applies the score change of a to this . /// - /// The judgement to apply/ - /// The judgement scoring result. - protected virtual void OnNewJudgement(JudgementResult result) + /// The to apply. + protected virtual void ApplyResult(JudgementResult result) { result.ComboAtJudgement = Combo; result.HighestComboAtJudgement = HighestCombo; @@ -299,11 +306,11 @@ namespace osu.Game.Rulesets.Scoring } /// - /// Removes a judgement. This should reverse everything in . + /// Resets the score change of a that was applied to this . /// /// The judgement to remove. /// The judgement scoring result. - protected virtual void OnJudgementRemoved(JudgementResult result) + protected virtual void ResetResult(JudgementResult result) { Combo.Value = result.ComboAtJudgement; HighestCombo.Value = result.HighestComboAtJudgement; @@ -356,6 +363,10 @@ namespace osu.Game.Rulesets.Scoring bonusScore = 0; } + /// + /// Creates the that represents the scoring result for a . + /// + /// The that provides the scoring information. protected virtual JudgementResult CreateJudgementResult(Judgement judgement) => new JudgementResult(judgement); } diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index e890cccc3c..23ec0575e3 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -182,8 +182,15 @@ namespace osu.Game.Rulesets.UI public abstract class RulesetContainer : RulesetContainer where TObject : HitObject { - public event Action OnJudgement; - public event Action OnJudgementRemoved; + /// + /// Invoked when a has been applied by any . + /// + public event Action OnNewResult; + + /// + /// Invoked when a has been reset by any . + /// + public event Action OnResultReset; /// /// The Beatmap @@ -290,8 +297,8 @@ namespace osu.Game.Rulesets.UI if (drawableObject == null) continue; - drawableObject.OnJudgement += (_, r) => OnJudgement?.Invoke(r); - drawableObject.OnJudgementRemoved += (_, r) => OnJudgementRemoved?.Invoke(r); + drawableObject.OnNewResult += (_, r) => OnNewResult?.Invoke(r); + drawableObject.OnResultReset += (_, r) => OnResultReset?.Invoke(r); Playfield.Add(drawableObject); } From b35817c8779cf5a761a432a8c3f14d8a688f9d7c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Aug 2018 10:55:38 +0900 Subject: [PATCH 273/304] More xmldocs to hitobject/drawablehitobject --- osu.Game/Rulesets/Judgements/Judgement.cs | 4 ++++ osu.Game/Rulesets/Judgements/JudgementResult.cs | 16 ++++++++++++---- .../Objects/Drawables/DrawableHitObject.cs | 12 ++++++++++-- osu.Game/Rulesets/Objects/HitObject.cs | 8 ++++++-- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/osu.Game/Rulesets/Judgements/Judgement.cs b/osu.Game/Rulesets/Judgements/Judgement.cs index 5fddbe0b0a..c679df5900 100644 --- a/osu.Game/Rulesets/Judgements/Judgement.cs +++ b/osu.Game/Rulesets/Judgements/Judgement.cs @@ -1,10 +1,14 @@ // 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; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Judgements { + /// + /// The scoring information provided by a . + /// public class Judgement { /// diff --git a/osu.Game/Rulesets/Judgements/JudgementResult.cs b/osu.Game/Rulesets/Judgements/JudgementResult.cs index 6971fcf593..5cadf7e2ee 100644 --- a/osu.Game/Rulesets/Judgements/JudgementResult.cs +++ b/osu.Game/Rulesets/Judgements/JudgementResult.cs @@ -1,10 +1,14 @@ // 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; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Judgements { + /// + /// The scoring result of a . + /// public class JudgementResult { /// @@ -19,22 +23,22 @@ namespace osu.Game.Rulesets.Judgements /// /// The offset from a perfect hit at which this occurred. - /// Populated when added via . + /// Populated when this is applied via . /// public double TimeOffset { get; internal set; } /// - /// The combo prior to this judgement occurring. + /// The combo prior to this occurring. /// public int ComboAtJudgement { get; internal set; } /// - /// The highest combo achieved prior to this judgement occurring. + /// The highest combo achieved prior to this occurring. /// public int HighestComboAtJudgement { get; internal set; } /// - /// Whether this has a result. + /// Whether a miss or hit occurred. /// public bool HasResult => Type > HitResult.None; @@ -43,6 +47,10 @@ namespace osu.Game.Rulesets.Judgements /// public bool IsHit => Type > HitResult.Miss; + /// + /// Creates a new . + /// + /// The to refer to for scoring information. public JudgementResult(Judgement judgement) { Judgement = judgement; diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 0bc7a160ce..4b3129929e 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -67,6 +67,9 @@ namespace osu.Game.Rulesets.Objects.Drawables /// public bool Judged => Result?.HasResult ?? true; + /// + /// The scoring result of this . + /// public readonly JudgementResult Result; private bool judgementOccurred; @@ -177,9 +180,10 @@ namespace osu.Game.Rulesets.Objects.Drawables } /// - /// Notifies that a new judgement has occurred for this . + /// Applies the of this , notifying responders such as + /// the of the . /// - /// The . + /// The callback that applies changes to the . protected void ApplyResult(Action application) { application?.Invoke(Result); @@ -240,6 +244,10 @@ namespace osu.Game.Rulesets.Objects.Drawables { } + /// + /// Creates the that represents the scoring result for this . + /// + /// The that provides the scoring information. protected virtual JudgementResult CreateJudgementResult(Judgement judgement) => new JudgementResult(judgement); } diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index 531a8bed38..a9cf23f924 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -108,10 +108,14 @@ namespace osu.Game.Rulesets.Objects { } - protected virtual Judgement CreateJudgement() => null; - protected void AddNested(HitObject hitObject) => nestedHitObjects.Value.Add(hitObject); + /// + /// Creates the that represents the scoring information for this . + /// May be null. + /// + protected virtual Judgement CreateJudgement() => null; + /// /// Creates the for this . /// This can be null to indicate that the has no . From 754f3c86212f81a183d192351a48ddd53728b717 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Aug 2018 11:07:05 +0900 Subject: [PATCH 274/304] Move result creation to load(), add exceptions --- .../Objects/Drawables/DrawableHitObject.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 4b3129929e..910abfeb4a 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; +using osu.Framework.Extensions.TypeExtensions; using osu.Game.Audio; using osu.Game.Graphics; using osu.Game.Rulesets.Judgements; @@ -70,7 +71,7 @@ namespace osu.Game.Rulesets.Objects.Drawables /// /// The scoring result of this . /// - public readonly JudgementResult Result; + public JudgementResult Result { get; private set; } private bool judgementOccurred; @@ -87,14 +88,19 @@ namespace osu.Game.Rulesets.Objects.Drawables protected DrawableHitObject(HitObject hitObject) { HitObject = hitObject; - - if (hitObject.Judgement != null) - Result = CreateJudgementResult(hitObject.Judgement); } [BackgroundDependencyLoader] private void load() { + if (HitObject.Judgement != null) + { + Result = CreateJudgementResult(HitObject.Judgement); + + if (Result == null) + throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateJudgementResult)}."); + } + var samples = GetSamples().ToArray(); if (samples.Any()) @@ -188,6 +194,9 @@ namespace osu.Game.Rulesets.Objects.Drawables { application?.Invoke(Result); + if (!Result.HasResult) + throw new InvalidOperationException($"{GetType().ReadableName()} applied a {nameof(JudgementResult)} but did not update {nameof(JudgementResult.Type)}."); + judgementOccurred = true; // Ensure that the judgement is given a valid time offset, because this may not get set by the caller From ab642b563fe1ac4a3b1fe6ae3ec296dd3150072b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Aug 2018 11:07:41 +0900 Subject: [PATCH 275/304] CreateJudgementResult -> CreateResult --- .../Objects/Drawables/DrawableOsuHitObject.cs | 2 +- osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs | 2 +- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 6 +++--- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 2529ac20c4..0501f8b7a0 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -68,6 +68,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private OsuInputManager osuActionInputManager; internal OsuInputManager OsuActionInputManager => osuActionInputManager ?? (osuActionInputManager = GetContainingInputManager() as OsuInputManager); - protected override JudgementResult CreateJudgementResult(Judgement judgement) => new OsuJudgementResult(judgement); + protected override JudgementResult CreateResult(Judgement judgement) => new OsuJudgementResult(judgement); } } diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index d935c28365..a9d39e88b4 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -87,6 +87,6 @@ namespace osu.Game.Rulesets.Osu.Scoring } } - protected override JudgementResult CreateJudgementResult(Judgement judgement) => new OsuJudgementResult(judgement); + protected override JudgementResult CreateResult(Judgement judgement) => new OsuJudgementResult(judgement); } } diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 910abfeb4a..f29a6fb6db 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -95,10 +95,10 @@ namespace osu.Game.Rulesets.Objects.Drawables { if (HitObject.Judgement != null) { - Result = CreateJudgementResult(HitObject.Judgement); + Result = CreateResult(HitObject.Judgement); if (Result == null) - throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateJudgementResult)}."); + throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateResult)}."); } var samples = GetSamples().ToArray(); @@ -257,7 +257,7 @@ namespace osu.Game.Rulesets.Objects.Drawables /// Creates the that represents the scoring result for this . /// /// The that provides the scoring information. - protected virtual JudgementResult CreateJudgementResult(Judgement judgement) => new JudgementResult(judgement); + protected virtual JudgementResult CreateResult(Judgement judgement) => new JudgementResult(judgement); } public abstract class DrawableHitObject : DrawableHitObject diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index b727a0d685..4cadae4212 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -236,7 +236,7 @@ namespace osu.Game.Rulesets.Scoring if (obj.Judgement == null) return; - var result = CreateJudgementResult(obj.Judgement); + var result = CreateResult(obj.Judgement); result.Type = obj.Judgement.MaxResult; applyResult(result); @@ -367,7 +367,7 @@ namespace osu.Game.Rulesets.Scoring /// Creates the that represents the scoring result for a . /// /// The that provides the scoring information. - protected virtual JudgementResult CreateJudgementResult(Judgement judgement) => new JudgementResult(judgement); + protected virtual JudgementResult CreateResult(Judgement judgement) => new JudgementResult(judgement); } public enum ScoringMode From 741ec0021ef9286cbaa96055c5e53a3345a5acd7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Aug 2018 11:31:46 +0900 Subject: [PATCH 276/304] Rename more judgement-related methods to "result" --- .../Objects/Drawable/DrawableCatchHitObject.cs | 2 +- .../Objects/Drawables/DrawableHoldNote.cs | 8 ++++---- .../Objects/Drawables/DrawableHoldNoteTick.cs | 2 +- .../Objects/Drawables/DrawableNote.cs | 4 ++-- osu.Game.Rulesets.Mania/UI/Column.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaStage.cs | 2 +- osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs | 4 ++-- osu.Game.Rulesets.Osu.Tests/TestCaseSpinner.cs | 4 ++-- .../Objects/Drawables/DrawableHitCircle.cs | 4 ++-- .../Objects/Drawables/DrawableRepeatPoint.cs | 2 +- .../Objects/Drawables/DrawableSlider.cs | 2 +- .../Objects/Drawables/DrawableSliderTail.cs | 4 ++-- .../Objects/Drawables/DrawableSliderTick.cs | 4 ++-- .../Objects/Drawables/DrawableSpinner.cs | 2 +- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 2 +- .../Objects/Drawables/DrawableDrumRoll.cs | 4 ++-- .../Objects/Drawables/DrawableDrumRollTick.cs | 8 ++++---- .../Objects/Drawables/DrawableHit.cs | 10 +++++----- .../Objects/Drawables/DrawableStrongHandler.cs | 2 +- .../Objects/Drawables/DrawableSwell.cs | 4 ++-- .../Objects/Drawables/DrawableSwellTick.cs | 4 ++-- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 2 +- .../Rulesets/Objects/Drawables/DrawableHitObject.cs | 12 ++++++------ 23 files changed, 47 insertions(+), 47 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs index 982fa193c6..9e840301fd 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs @@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable public Func CheckPosition; - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (CheckPosition == null) return; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index da4bf1c575..f9501bdb87 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables /// public class DrawableHoldNote : DrawableManiaHitObject, IKeyBindingHandler { - public override bool DisplayJudgement => false; + public override bool DisplayResult => false; private readonly DrawableNote head; private readonly DrawableNote tail; @@ -96,7 +96,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables } } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (tail.AllJudged) ApplyResult(r => r.Type = HitResult.Perfect); @@ -196,7 +196,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables this.holdNote = holdNote; } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { // Factor in the release lenience timeOffset /= release_window_lenience; @@ -233,7 +233,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (action != Action.Value) return false; - UpdateJudgement(true); + UpdateResult(true); // Handled by the hold note, which will set holding = false return false; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs index 05a4ea60d6..01d5bc6fd4 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs @@ -71,7 +71,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables } } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (Time.Current < HitObject.StartTime) return; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index 42b4128019..7567f40b2f 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs @@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables } } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (!userTriggered) { @@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (action != Action.Value) return false; - return UpdateJudgement(true); + return UpdateResult(true); } public virtual bool OnReleased(ManiaAction action) => false; diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index 500f999dd6..d489d48fc3 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -138,7 +138,7 @@ namespace osu.Game.Rulesets.Mania.UI internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result) { - if (!result.IsHit || !judgedObject.DisplayJudgement || !DisplayJudgements) + if (!result.IsHit || !judgedObject.DisplayResult || !DisplayJudgements) return; explosionContainer.Add(new HitExplosion(judgedObject) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs index f5993e61de..4e888b101b 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs @@ -163,7 +163,7 @@ namespace osu.Game.Rulesets.Mania.UI internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result) { - if (!judgedObject.DisplayJudgement || !DisplayJudgements) + if (!judgedObject.DisplayResult || !DisplayJudgements) return; judgements.Clear(); diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs index 79866b8a4a..c2d3aab2ab 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs @@ -94,7 +94,7 @@ namespace osu.Game.Rulesets.Osu.Tests this.auto = auto; } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (auto && !userTriggered && timeOffset > 0) { @@ -102,7 +102,7 @@ namespace osu.Game.Rulesets.Osu.Tests ApplyResult(r => r.Type = HitResult.Great); } else - base.CheckForJudgements(userTriggered, timeOffset); + base.CheckForResult(userTriggered, timeOffset); } } } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinner.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinner.cs index b05a763e88..3b91ea93b8 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinner.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinner.cs @@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Osu.Tests this.auto = auto; } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (auto && !userTriggered && Time.Current > Spinner.StartTime + Spinner.Duration / 2 && Progress < 1) { @@ -81,7 +81,7 @@ namespace osu.Game.Rulesets.Osu.Tests auto = false; } - base.CheckForJudgements(userTriggered, timeOffset); + base.CheckForResult(userTriggered, timeOffset); } } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 15521113ed..6344fbb770 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables if (AllJudged) return false; - UpdateJudgement(true); + UpdateResult(true); return true; }, }, @@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (!userTriggered) { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index ea1ee9fb1e..dfe7937e81 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables }; } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (repeatPoint.StartTime <= Time.Current) ApplyResult(r => r.Type = drawableSlider.Tracking ? HitResult.Great : HitResult.Miss); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 71be07f166..f48f03f197 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -131,7 +131,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (userTriggered || Time.Current < slider.EndTime) return; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs index 9261741a12..45c925b87a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs @@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables /// /// The judgement text is provided by the . /// - public override bool DisplayJudgement => false; + public override bool DisplayResult => false; public bool Tracking { get; set; } @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Position = HitObject.Position - slider.Position; } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (!userTriggered && timeOffset >= 0) ApplyResult(r => r.Type = Tracking ? HitResult.Great : HitResult.Miss); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index 8819fa962b..964c75131a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public bool Tracking { get; set; } - public override bool DisplayJudgement => false; + public override bool DisplayResult => false; public DrawableSliderTick(SliderTick sliderTick) : base(sliderTick) { @@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables }; } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (timeOffset >= 0) ApplyResult(r => r.Type = Tracking ? HitResult.Great : HitResult.Miss); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 3feb612c8b..51b1990a21 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -116,7 +116,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public float Progress => MathHelper.Clamp(Disc.RotationAbsolute / 360 / Spinner.SpinsRequired, 0, 1); - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (Time.Current < HitObject.StartTime) return; diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 989b1ed964..703d8764fc 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Osu.UI private void onNewResult(DrawableHitObject judgedObject, JudgementResult result) { - if (!judgedObject.DisplayJudgement || !DisplayJudgements) + if (!judgedObject.DisplayResult || !DisplayJudgements) return; DrawableOsuJudgement explosion = new DrawableOsuJudgement(result, judgedObject) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs index 18669cec2b..0fb2405f77 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables MainPiece.FadeAccent(newColour, 100); } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (userTriggered) return; @@ -108,7 +108,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (!MainObject.Judged) return; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs index cbe6e10dcb..ff1cce24b6 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs @@ -17,14 +17,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables FillMode = FillMode.Fit; } - public override bool DisplayJudgement => false; + public override bool DisplayResult => false; protected override TaikoPiece CreateMainPiece() => new TickPiece { Filled = HitObject.FirstTick }; - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (!userTriggered) { @@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables } } - public override bool OnPressed(TaikoAction action) => UpdateJudgement(true); + public override bool OnPressed(TaikoAction action) => UpdateResult(true); protected override DrawableStrongHandler CreateStrongHandler(StrongHitObject hitObject) => new StrongHandler(hitObject, this); @@ -60,7 +60,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (!MainObject.Judged) return; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 4289a77f4c..6181b74822 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables FillMode = FillMode.Fit; } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (!userTriggered) { @@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables validActionPressed = HitActions.Contains(action); // Only count this as handled if the new judgement is a hit - var result = UpdateJudgement(true); + var result = UpdateResult(true); if (IsHit) HitAction = action; @@ -144,11 +144,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (!MainObject.Result.HasResult) { - base.CheckForJudgements(userTriggered, timeOffset); + base.CheckForResult(userTriggered, timeOffset); return; } @@ -183,7 +183,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables if (!MainObject.HitActions.Contains(action)) return false; - return UpdateJudgement(true); + return UpdateResult(true); } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs index 6f2db764a8..6406582191 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs @@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables /// public abstract class DrawableStrongHandler : DrawableTaikoHitObject { - public override bool DisplayJudgement => false; + public override bool DisplayResult => false; public readonly DrawableHitObject MainObject; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 24b1a0e9da..5059734663 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -131,7 +131,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables Width *= Parent.RelativeChildSize.X; } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { if (userTriggered) { @@ -231,7 +231,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables return false; lastWasCentre = isCentre; - UpdateJudgement(true); + UpdateResult(true); return true; } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs index 8266d329a2..36c468c6d6 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs @@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableSwellTick : DrawableTaikoHitObject { - public override bool DisplayJudgement => false; + public override bool DisplayResult => false; public DrawableSwellTick(TaikoHitObject hitObject) : base(hitObject) @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables public void TriggerResult(HitResult type) => ApplyResult(r => r.Type = type); - protected override void CheckForJudgements(bool userTriggered, double timeOffset) + protected override void CheckForResult(bool userTriggered, double timeOffset) { } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 8078f648e8..8973a4ef35 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -229,7 +229,7 @@ namespace osu.Game.Rulesets.Taiko.UI if (!DisplayJudgements) return; - if (!judgedObject.DisplayJudgement) + if (!judgedObject.DisplayResult) return; switch (result.Judgement) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index f29a6fb6db..4f7ec4c29e 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Objects.Drawables /// /// Whether a visible judgement should be displayed when this representation is hit. /// - public virtual bool DisplayJudgement => true; + public virtual bool DisplayResult => true; /// /// Whether this and all of its nested s have been judged. @@ -173,7 +173,7 @@ namespace osu.Game.Rulesets.Objects.Drawables { base.UpdateAfterChildren(); - UpdateJudgement(false); + UpdateResult(false); } protected virtual void AddNested(DrawableHitObject h) @@ -223,7 +223,7 @@ namespace osu.Game.Rulesets.Objects.Drawables /// /// Whether the user triggered this process. /// Whether a judgement has occurred from this or any nested s. - protected bool UpdateJudgement(bool userTriggered) + protected bool UpdateResult(bool userTriggered) { judgementOccurred = false; @@ -231,13 +231,13 @@ namespace osu.Game.Rulesets.Objects.Drawables return false; foreach (var d in NestedHitObjects) - judgementOccurred |= d.UpdateJudgement(userTriggered); + judgementOccurred |= d.UpdateResult(userTriggered); if (judgementOccurred || Judged) return judgementOccurred; var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; - CheckForJudgements(userTriggered, Time.Current - endTime); + CheckForResult(userTriggered, Time.Current - endTime); return judgementOccurred; } @@ -249,7 +249,7 @@ namespace osu.Game.Rulesets.Objects.Drawables /// Whether the user triggered this check. /// The offset from the end time at which this check occurred. A > 0 /// implies that this check occurred after the end time of . - protected virtual void CheckForJudgements(bool userTriggered, double timeOffset) + protected virtual void CheckForResult(bool userTriggered, double timeOffset) { } From 0d6a8a2bf561f863dbed4c41b5bfdfe57546700e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Aug 2018 11:31:54 +0900 Subject: [PATCH 277/304] More xmldocs --- .../Objects/Drawables/DrawableHitObject.cs | 16 +++++++++------- osu.Game/Rulesets/Objects/HitObject.cs | 6 ++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 4f7ec4c29e..17533f4ca0 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Objects.Drawables public event Action OnResultReset; /// - /// Whether a visible judgement should be displayed when this representation is hit. + /// Whether a visual indicator should be displayed when a scoring result occurs. /// public virtual bool DisplayResult => true; @@ -219,10 +219,10 @@ namespace osu.Game.Rulesets.Objects.Drawables } /// - /// Processes this , checking if any judgements have occurred. + /// Processes this , checking if a scoring result has occurred. /// /// Whether the user triggered this process. - /// Whether a judgement has occurred from this or any nested s. + /// Whether a scoring result has occurred from this or any nested . protected bool UpdateResult(bool userTriggered) { judgementOccurred = false; @@ -243,12 +243,14 @@ namespace osu.Game.Rulesets.Objects.Drawables } /// - /// Checks if any judgements have occurred for this . This method must construct - /// all s and notify of them through . + /// Checks if a scoring result has occurred for this . /// + /// + /// If a scoring result has occurred, this method must invoke to update the result and notify responders. + /// /// Whether the user triggered this check. - /// The offset from the end time at which this check occurred. A > 0 - /// implies that this check occurred after the end time of . + /// The offset from the end time of the at which this check occurred. + /// A > 0 implies that this check occurred after the end time of the . protected virtual void CheckForResult(bool userTriggered, double timeOffset) { } diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index a9cf23f924..eee690474b 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -63,6 +63,12 @@ namespace osu.Game.Rulesets.Objects [JsonIgnore] public IReadOnlyList NestedHitObjects => nestedHitObjects.Value; + /// + /// The judgement information provided by this . + /// + /// + /// Only populated after is invoked. + /// public Judgement Judgement { get; private set; } /// From 3a7488767c51b54b70e5e202f647c6404b8e0e46 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Aug 2018 11:50:18 +0900 Subject: [PATCH 278/304] Make HitObject not store the judgement --- osu.Game.Rulesets.Catch/Objects/Banana.cs | 2 +- osu.Game.Rulesets.Catch/Objects/Droplet.cs | 2 +- osu.Game.Rulesets.Catch/Objects/Fruit.cs | 2 +- osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs | 2 +- osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 2 +- osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs | 2 +- osu.Game.Rulesets.Mania/Objects/Note.cs | 2 +- osu.Game.Rulesets.Mania/Objects/TailNote.cs | 2 +- osu.Game.Rulesets.Osu/Objects/HitCircle.cs | 2 +- osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 +- osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs | 2 +- osu.Game.Rulesets.Osu/Objects/SliderTick.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Spinner.cs | 2 +- osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs | 2 +- osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs | 2 +- osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs | 2 +- .../Rulesets/Objects/Drawables/DrawableHitObject.cs | 6 +++--- osu.Game/Rulesets/Objects/HitObject.cs | 12 +----------- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 7 ++++--- 20 files changed, 25 insertions(+), 34 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Banana.cs b/osu.Game.Rulesets.Catch/Objects/Banana.cs index e021bafdb6..e1af4c1075 100644 --- a/osu.Game.Rulesets.Catch/Objects/Banana.cs +++ b/osu.Game.Rulesets.Catch/Objects/Banana.cs @@ -10,6 +10,6 @@ namespace osu.Game.Rulesets.Catch.Objects { public override FruitVisualRepresentation VisualRepresentation => FruitVisualRepresentation.Banana; - protected override Judgement CreateJudgement() => new CatchBananaJudgement(); + public override Judgement CreateJudgement() => new CatchBananaJudgement(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/Droplet.cs b/osu.Game.Rulesets.Catch/Objects/Droplet.cs index 79aefdb6d3..8b54922959 100644 --- a/osu.Game.Rulesets.Catch/Objects/Droplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Droplet.cs @@ -8,6 +8,6 @@ namespace osu.Game.Rulesets.Catch.Objects { public class Droplet : CatchHitObject { - protected override Judgement CreateJudgement() => new CatchDropletJudgement(); + public override Judgement CreateJudgement() => new CatchDropletJudgement(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/Fruit.cs b/osu.Game.Rulesets.Catch/Objects/Fruit.cs index 53a484ed56..2c2cd013c3 100644 --- a/osu.Game.Rulesets.Catch/Objects/Fruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Fruit.cs @@ -8,6 +8,6 @@ namespace osu.Game.Rulesets.Catch.Objects { public class Fruit : CatchHitObject { - protected override Judgement CreateJudgement() => new CatchJudgement(); + public override Judgement CreateJudgement() => new CatchJudgement(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs b/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs index ddb88c2c1c..39f1cadad5 100644 --- a/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/TinyDroplet.cs @@ -8,6 +8,6 @@ namespace osu.Game.Rulesets.Catch.Objects { public class TinyDroplet : Droplet { - protected override Judgement CreateJudgement() => new CatchTinyDropletJudgement(); + public override Judgement CreateJudgement() => new CatchTinyDropletJudgement(); } } diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index 26116c2691..e493956d6e 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -97,6 +97,6 @@ namespace osu.Game.Rulesets.Mania.Objects } } - protected override Judgement CreateJudgement() => new HoldNoteJudgement(); + public override Judgement CreateJudgement() => new HoldNoteJudgement(); } } diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs index b428c6158d..05959a31c0 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNoteTick.cs @@ -11,6 +11,6 @@ namespace osu.Game.Rulesets.Mania.Objects /// public class HoldNoteTick : ManiaHitObject { - protected override Judgement CreateJudgement() => new HoldNoteTickJudgement(); + public override Judgement CreateJudgement() => new HoldNoteTickJudgement(); } } diff --git a/osu.Game.Rulesets.Mania/Objects/Note.cs b/osu.Game.Rulesets.Mania/Objects/Note.cs index ffc3ed0bd7..42877649d2 100644 --- a/osu.Game.Rulesets.Mania/Objects/Note.cs +++ b/osu.Game.Rulesets.Mania/Objects/Note.cs @@ -11,6 +11,6 @@ namespace osu.Game.Rulesets.Mania.Objects /// public class Note : ManiaHitObject { - protected override Judgement CreateJudgement() => new ManiaJudgement(); + public override Judgement CreateJudgement() => new ManiaJudgement(); } } diff --git a/osu.Game.Rulesets.Mania/Objects/TailNote.cs b/osu.Game.Rulesets.Mania/Objects/TailNote.cs index 522f78336f..9de542bcd3 100644 --- a/osu.Game.Rulesets.Mania/Objects/TailNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/TailNote.cs @@ -8,6 +8,6 @@ namespace osu.Game.Rulesets.Mania.Objects { public class TailNote : Note { - protected override Judgement CreateJudgement() => new ManiaJudgement(); + public override Judgement CreateJudgement() => new ManiaJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/HitCircle.cs b/osu.Game.Rulesets.Osu/Objects/HitCircle.cs index b5e64e9e40..d1656a9672 100644 --- a/osu.Game.Rulesets.Osu/Objects/HitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/HitCircle.cs @@ -8,6 +8,6 @@ namespace osu.Game.Rulesets.Osu.Objects { public class HitCircle : OsuHitObject { - protected override Judgement CreateJudgement() => new OsuJudgement(); + public override Judgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs index 83f7f79f39..c8621cdbcf 100644 --- a/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/RepeatPoint.cs @@ -27,6 +27,6 @@ namespace osu.Game.Rulesets.Osu.Objects TimePreempt = Math.Min(SpanDuration * 2, TimePreempt); } - protected override Judgement CreateJudgement() => new OsuJudgement(); + public override Judgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index eead98ac28..7a0dcc77a6 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -214,6 +214,6 @@ namespace osu.Game.Rulesets.Osu.Objects } } - protected override Judgement CreateJudgement() => new OsuJudgement(); + public override Judgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs index faa325d416..23616ea005 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs @@ -13,6 +13,6 @@ namespace osu.Game.Rulesets.Osu.Objects { } - protected override Judgement CreateJudgement() => new OsuSliderTailJudgement(); + public override Judgement CreateJudgement() => new OsuSliderTailJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs index 000781dec6..906f0a0182 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs @@ -29,6 +29,6 @@ namespace osu.Game.Rulesets.Osu.Objects TimePreempt = (StartTime - SpanStartTime) / 2 + offset; } - protected override Judgement CreateJudgement() => new OsuJudgement(); + public override Judgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs index d100e33f17..e1a7a7c6df 100644 --- a/osu.Game.Rulesets.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -32,6 +32,6 @@ namespace osu.Game.Rulesets.Osu.Objects SpinsRequired = (int)Math.Max(1, SpinsRequired * 0.6); } - protected override Judgement CreateJudgement() => new OsuJudgement(); + public override Judgement CreateJudgement() => new OsuJudgement(); } } diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs index f6a3a5efef..967d5acfd7 100644 --- a/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs @@ -24,6 +24,6 @@ namespace osu.Game.Rulesets.Taiko.Objects /// public double HitWindow => TickSpacing / 2; - protected override Judgement CreateJudgement() => new TaikoDrumRollTickJudgement(); + public override Judgement CreateJudgement() => new TaikoDrumRollTickJudgement(); } } diff --git a/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs index a9d452cc68..fac3705110 100644 --- a/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/StrongHitObject.cs @@ -8,6 +8,6 @@ namespace osu.Game.Rulesets.Taiko.Objects { public class StrongHitObject : TaikoHitObject { - protected override Judgement CreateJudgement() => new TaikoStrongJudgement(); + public override Judgement CreateJudgement() => new TaikoStrongJudgement(); } } diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs index 702b6d73b6..6948c5bcde 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Taiko.Objects AddNested(new StrongHitObject { StartTime = (this as IHasEndTime)?.EndTime ?? StartTime }); } - protected override Judgement CreateJudgement() => new TaikoJudgement(); + public override Judgement CreateJudgement() => new TaikoJudgement(); protected override HitWindows CreateHitWindows() => new TaikoHitWindows(); } diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 17533f4ca0..e1848412c2 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -93,10 +93,10 @@ namespace osu.Game.Rulesets.Objects.Drawables [BackgroundDependencyLoader] private void load() { - if (HitObject.Judgement != null) + var judgement = HitObject.CreateJudgement(); + if (judgement != null) { - Result = CreateResult(HitObject.Judgement); - + Result = CreateResult(judgement); if (Result == null) throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateResult)}."); } diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index eee690474b..beb9620f78 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -63,14 +63,6 @@ namespace osu.Game.Rulesets.Objects [JsonIgnore] public IReadOnlyList NestedHitObjects => nestedHitObjects.Value; - /// - /// The judgement information provided by this . - /// - /// - /// Only populated after is invoked. - /// - public Judgement Judgement { get; private set; } - /// /// Applies default values to this HitObject. /// @@ -80,8 +72,6 @@ namespace osu.Game.Rulesets.Objects { ApplyDefaultsToSelf(controlPointInfo, difficulty); - Judgement = CreateJudgement(); - if (nestedHitObjects.IsValueCreated) nestedHitObjects.Value.Clear(); @@ -120,7 +110,7 @@ namespace osu.Game.Rulesets.Objects /// Creates the that represents the scoring information for this . /// May be null. /// - protected virtual Judgement CreateJudgement() => null; + public virtual Judgement CreateJudgement() => null; /// /// Creates the for this . diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 4cadae4212..a185648531 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -233,11 +233,12 @@ namespace osu.Game.Rulesets.Scoring foreach (var nested in obj.NestedHitObjects) simulate(nested); - if (obj.Judgement == null) + var judgement = obj.CreateJudgement(); + if (judgement == null) return; - var result = CreateResult(obj.Judgement); - result.Type = obj.Judgement.MaxResult; + var result = CreateResult(judgement); + result.Type = judgement.MaxResult; applyResult(result); } From 35b5aeb99ad13c12c756d89a9499336ce3c1379c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Aug 2018 12:23:08 +0900 Subject: [PATCH 279/304] Fix missed rename --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 2 +- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index ffb93fd679..d49be69856 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -68,6 +68,6 @@ namespace osu.Game.Rulesets.Catch.UI } private void onNewResult(DrawableHitObject judgedObject, JudgementResult result) - => catcherArea.OnJudgement((DrawableCatchHitObject)judgedObject, result); + => catcherArea.OnResult((DrawableCatchHitObject)judgedObject, result); } } diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index ca9fa6f595..4327abb96f 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Catch.UI private DrawableCatchHitObject lastPlateableFruit; - public void OnJudgement(DrawableCatchHitObject fruit, JudgementResult result) + public void OnResult(DrawableCatchHitObject fruit, JudgementResult result) { void runAfterLoaded(Action action) { From c48a4d999352c7c2c0a135ff38bb3ce08c142701 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Aug 2018 12:29:12 +0900 Subject: [PATCH 280/304] Add exception --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index a185648531..1f0584405a 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -238,6 +238,9 @@ namespace osu.Game.Rulesets.Scoring return; var result = CreateResult(judgement); + if (result == null) + throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateResult)}."); + result.Type = judgement.MaxResult; applyResult(result); From 2a54b5b78d06859816fffed21511fee2b9657bdc Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Aug 2018 12:29:22 +0900 Subject: [PATCH 281/304] ResetResult -> RevertResult --- .../Rulesets/Objects/Drawables/DrawableHitObject.cs | 8 ++++---- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 13 +++++++------ osu.Game/Rulesets/UI/RulesetContainer.cs | 8 ++++---- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index e1848412c2..2abb2eb289 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -42,9 +42,9 @@ namespace osu.Game.Rulesets.Objects.Drawables public event Action OnNewResult; /// - /// Invoked when a has been reset by this or a nested . + /// Invoked when a is being reverted by this or a nested . /// - public event Action OnResultReset; + public event Action OnRevertResult; /// /// Whether a visual indicator should be displayed when a scoring result occurs. @@ -159,7 +159,7 @@ namespace osu.Game.Rulesets.Objects.Drawables if (Result.TimeOffset + endTime < Time.Current) { - OnResultReset?.Invoke(this, Result); + OnRevertResult?.Invoke(this, Result); Result.Type = HitResult.None; State.Value = ArmedState.Idle; @@ -179,7 +179,7 @@ namespace osu.Game.Rulesets.Objects.Drawables protected virtual void AddNested(DrawableHitObject h) { h.OnNewResult += (d, r) => OnNewResult?.Invoke(d, r); - h.OnResultReset += (d, r) => OnResultReset?.Invoke(d, r); + h.OnRevertResult += (d, r) => OnRevertResult?.Invoke(d, r); h.ApplyCustomUpdateState += (d, j) => ApplyCustomUpdateState?.Invoke(d, j); nestedHitObjects.Value.Add(h); diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 1f0584405a..d8c72d4b2e 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -4,6 +4,7 @@ using System; using System.Diagnostics; using osu.Framework.Configuration; +using osu.Framework.Extensions.TypeExtensions; using osu.Game.Beatmaps; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; @@ -196,7 +197,7 @@ namespace osu.Game.Rulesets.Scoring Debug.Assert(base_portion + combo_portion == 1.0); rulesetContainer.OnNewResult += applyResult; - rulesetContainer.OnResultReset += resetResult; + rulesetContainer.OnRevertResult += revertResult; SimulateAutoplay(rulesetContainer.Beatmap); Reset(true); @@ -261,13 +262,13 @@ namespace osu.Game.Rulesets.Scoring } /// - /// Resets the score change of a that was applied to this . + /// Reverts the score change of a that was applied to this . /// /// The judgement to remove. /// The judgement scoring result. - private void resetResult(JudgementResult result) + private void revertResult(JudgementResult result) { - ResetResult(result); + RevertResult(result); updateScore(); } @@ -310,11 +311,11 @@ namespace osu.Game.Rulesets.Scoring } /// - /// Resets the score change of a that was applied to this . + /// Reverts the score change of a that was applied to this . /// /// The judgement to remove. /// The judgement scoring result. - protected virtual void ResetResult(JudgementResult result) + protected virtual void RevertResult(JudgementResult result) { Combo.Value = result.ComboAtJudgement; HighestCombo.Value = result.HighestComboAtJudgement; diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index 23ec0575e3..64ee680d45 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -183,14 +183,14 @@ namespace osu.Game.Rulesets.UI where TObject : HitObject { /// - /// Invoked when a has been applied by any . + /// Invoked when a has been applied by a . /// public event Action OnNewResult; /// - /// Invoked when a has been reset by any . + /// Invoked when a is being reverted by a . /// - public event Action OnResultReset; + public event Action OnRevertResult; /// /// The Beatmap @@ -298,7 +298,7 @@ namespace osu.Game.Rulesets.UI continue; drawableObject.OnNewResult += (_, r) => OnNewResult?.Invoke(r); - drawableObject.OnResultReset += (_, r) => OnResultReset?.Invoke(r); + drawableObject.OnRevertResult += (_, r) => OnRevertResult?.Invoke(r); Playfield.Add(drawableObject); } From 60c94a8ea37ef63e0664ccb5acecf20447ed3fc4 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Aug 2018 12:42:28 +0900 Subject: [PATCH 282/304] Fix ScoreProcessor.ApplyBeatmap never being called --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index d8c72d4b2e..b0cea7009e 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -199,6 +199,7 @@ namespace osu.Game.Rulesets.Scoring rulesetContainer.OnNewResult += applyResult; rulesetContainer.OnRevertResult += revertResult; + ApplyBeatmap(rulesetContainer.Beatmap); SimulateAutoplay(rulesetContainer.Beatmap); Reset(true); From 5c4c2dff09fde00e063053ded0d6c9b2480bead8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 6 Aug 2018 13:01:27 +0900 Subject: [PATCH 283/304] Fix strong hits not being visualised --- .../TestCaseTaikoPlayfield.cs | 39 ++++++++++++++----- .../Drawables/DrawableStrongHandler.cs | 2 - 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs index 23c57e0767..b002c2abab 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs @@ -39,8 +39,10 @@ namespace osu.Game.Rulesets.Taiko.Tests [BackgroundDependencyLoader] private void load() { - AddStep("Hit!", () => addHitJudgement(false)); + AddStep("Hit", () => addHitJudgement(false)); + AddStep("Strong hit", () => addStrongHitJudgement(false)); AddStep("Kiai hit", () => addHitJudgement(true)); + AddStep("Strong kiai hit", () => addStrongHitJudgement(true)); AddStep("Miss :(", addMissJudgement); AddStep("DrumRoll", () => addDrumRoll(false)); AddStep("Strong DrumRoll", () => addDrumRoll(true)); @@ -130,10 +132,7 @@ namespace osu.Game.Rulesets.Taiko.Tests HitResult hitResult = RNG.Next(2) == 0 ? HitResult.Good : HitResult.Great; var cpi = new ControlPointInfo(); - cpi.EffectPoints.Add(new EffectControlPoint - { - KiaiMode = kiai - }); + cpi.EffectPoints.Add(new EffectControlPoint { KiaiMode = kiai }); Hit hit = new Hit(); hit.ApplyDefaults(cpi, new BeatmapDifficulty()); @@ -141,12 +140,22 @@ namespace osu.Game.Rulesets.Taiko.Tests var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) }; ((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult }); + } - if (RNG.Next(10) == 0) - { - ((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult }); - ((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(h, new JudgementResult(new TaikoStrongJudgement()) { Type = HitResult.Great }); - } + private void addStrongHitJudgement(bool kiai) + { + HitResult hitResult = RNG.Next(2) == 0 ? HitResult.Good : HitResult.Great; + + var cpi = new ControlPointInfo(); + cpi.EffectPoints.Add(new EffectControlPoint { KiaiMode = kiai }); + + Hit hit = new Hit(); + hit.ApplyDefaults(cpi, new BeatmapDifficulty()); + + var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) }; + + ((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult }); + ((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(new TestStrongHandler(h), new JudgementResult(new TaikoStrongJudgement()) { Type = HitResult.Great }); } private void addMissJudgement() @@ -217,6 +226,16 @@ namespace osu.Game.Rulesets.Taiko.Tests rulesetContainer.Playfield.Add(new DrawableRimHit(h)); } + private class TestStrongHandler : DrawableStrongHandler + { + public TestStrongHandler(DrawableHitObject mainObject) + : base(null, mainObject) + { + } + + public override bool OnPressed(TaikoAction action) => false; + } + private class DrawableTestHit : DrawableHitObject { public DrawableTestHit(TaikoHitObject hitObject) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs index 6406582191..45a853b94b 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs @@ -11,8 +11,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables /// public abstract class DrawableStrongHandler : DrawableTaikoHitObject { - public override bool DisplayResult => false; - public readonly DrawableHitObject MainObject; protected DrawableStrongHandler(StrongHitObject strong, DrawableHitObject mainObject) From 5d573ae17618e993e8f8651ae10ee352c1a54165 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Aug 2018 01:00:06 +0900 Subject: [PATCH 284/304] Update squirrel --- osu.Desktop/osu.Desktop.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 6ee9c3155e..8968a82294 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -27,7 +27,7 @@ - + From 7233e863dbbacb31043ef3c1d04158f27be834dc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Aug 2018 01:07:50 +0900 Subject: [PATCH 285/304] 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 1fed7f46bc..e9fc51ee9b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 8ee38460d37ccef81fe474c1a13a9b2bd53cf3b1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Aug 2018 02:01:31 +0900 Subject: [PATCH 286/304] Bump squirrel version with bugfix --- osu.Desktop/osu.Desktop.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 8968a82294..180abd7fec 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -27,7 +27,7 @@ - + From f719b9bef58da1e82dce0d702c8f498446dd5865 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 7 Aug 2018 12:20:24 +0900 Subject: [PATCH 287/304] Fix mania scroll direction not being read from database --- osu.Game.Rulesets.Mania/UI/ManiaScrollingInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaScrollingInfo.cs b/osu.Game.Rulesets.Mania/UI/ManiaScrollingInfo.cs index a1cc7cfbc7..624ea13e1b 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaScrollingInfo.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaScrollingInfo.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mania.UI public ManiaScrollingInfo(ManiaConfigManager config) { config.BindWith(ManiaSetting.ScrollDirection, configDirection); - configDirection.BindValueChanged(v => Direction.Value = (ScrollingDirection)v); + configDirection.BindValueChanged(v => Direction.Value = (ScrollingDirection)v, true); } } } From 7b8bd7f21c6b1b7f2b36cde8ce57f46b0e9d9f55 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Aug 2018 14:49:44 +0900 Subject: [PATCH 288/304] Fix mod selection not restoring when re-entering song select --- osu.Game.Tests/Visual/TestCaseMods.cs | 3 + osu.Game/OsuGame.cs | 5 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 70 ++++++++++++---------- osu.Game/Screens/Select/PlaySongSelect.cs | 15 +++-- 4 files changed, 54 insertions(+), 39 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseMods.cs b/osu.Game.Tests/Visual/TestCaseMods.cs index cc396a63e3..6330afe860 100644 --- a/osu.Game.Tests/Visual/TestCaseMods.cs +++ b/osu.Game.Tests/Visual/TestCaseMods.cs @@ -13,6 +13,7 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Mods; using System.Linq; using System.Collections.Generic; +using osu.Framework.Configuration; using osu.Game.Rulesets.Osu; using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.Sprites; @@ -237,6 +238,8 @@ namespace osu.Game.Tests.Visual private class TestModSelectOverlay : ModSelectOverlay { + public new Bindable> SelectedMods => base.SelectedMods; + public ModButton GetModButton(Mod mod) { var section = ModSectionsContainer.Children.Single(s => s.ModType == mod.Type); diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 025d5f50e3..69d1236126 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -99,7 +99,7 @@ namespace osu.Game private readonly List overlays = new List(); // todo: move this to SongSelect once Screen has the ability to unsuspend. - public readonly Bindable> SelectedMods = new Bindable>(new List()); + private readonly Bindable> selectedMods = new Bindable>(new List()); public OsuGame(string[] args = null) { @@ -153,6 +153,9 @@ namespace osu.Game dependencies.CacheAs(ruleset); dependencies.CacheAs>(ruleset); + dependencies.CacheAs(selectedMods); + dependencies.CacheAs>>(selectedMods); + // bind config int to database RulesetInfo configRuleset = LocalConfig.GetBindable(OsuSetting.Ruleset); ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First(); diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 4745eba68d..3f28b7ccfd 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -39,9 +39,39 @@ namespace osu.Game.Overlays.Mods protected readonly FillFlowContainer ModSectionsContainer; - public readonly Bindable> SelectedMods = new Bindable>(); + protected readonly Bindable> SelectedMods = new Bindable>(); - public readonly IBindable Ruleset = new Bindable(); + protected readonly IBindable Ruleset = new Bindable(); + + [BackgroundDependencyLoader] + private void load(OsuColour colours, IBindable ruleset, AudioManager audio, Bindable> selectedMods) + { + LowMultiplierColour = colours.Red; + HighMultiplierColour = colours.Green; + UnrankedLabel.Colour = colours.Blue; + + Ruleset.BindTo(ruleset); + SelectedMods.BindTo(selectedMods); + + sampleOn = audio.Sample.Get(@"UI/check-on"); + sampleOff = audio.Sample.Get(@"UI/check-off"); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + Ruleset.BindValueChanged(rulesetChanged, true); + SelectedMods.BindValueChanged(selectedModsChanged, true); + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + Ruleset.UnbindAll(); + SelectedMods.UnbindAll(); + } private void rulesetChanged(RulesetInfo newRuleset) { @@ -51,33 +81,16 @@ namespace osu.Game.Overlays.Mods foreach (ModSection section in ModSectionsContainer.Children) section.Mods = instance.GetModsFor(section.ModType); + + // attempt to re-select any already selected mods. + // this may be the first time we are receiving the ruleset, in which case they will still match. + selectedModsChanged(SelectedMods.Value); + + // write the mods back to the SelectedMods bindable in the case a change was not applicable. + // this generally isn't required as the previous line will perform deselection; just here for safety. refreshSelectedMods(); } - [BackgroundDependencyLoader] - private void load(OsuColour colours, IBindable ruleset, AudioManager audio) - { - SelectedMods.ValueChanged += selectedModsChanged; - - LowMultiplierColour = colours.Red; - HighMultiplierColour = colours.Green; - UnrankedLabel.Colour = colours.Blue; - - Ruleset.BindTo(ruleset); - Ruleset.BindValueChanged(rulesetChanged, true); - - sampleOn = audio.Sample.Get(@"UI/check-on"); - sampleOff = audio.Sample.Get(@"UI/check-off"); - } - - protected override void Dispose(bool isDisposing) - { - base.Dispose(isDisposing); - - Ruleset.UnbindAll(); - SelectedMods.UnbindAll(); - } - private void selectedModsChanged(IEnumerable obj) { foreach (ModSection section in ModSectionsContainer.Children) @@ -176,10 +189,7 @@ namespace osu.Game.Overlays.Mods refreshSelectedMods(); } - private void refreshSelectedMods() - { - SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray(); - } + private void refreshSelectedMods() => SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray(); public ModSelectOverlay() { diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index a346911ca2..7a832caf41 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -50,13 +50,12 @@ namespace osu.Game.Screens.Select private SampleChannel sampleConfirm; - public readonly Bindable> SelectedMods = new Bindable>(new List()); + private readonly Bindable> selectedMods = new Bindable>(new List()); [BackgroundDependencyLoader(true)] - private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, OsuGame osu) + private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, Bindable> selectedMods) { - if (osu != null) SelectedMods.BindTo(osu.SelectedMods); - modSelect.SelectedMods.BindTo(SelectedMods); + if (selectedMods != null) this.selectedMods.BindTo(selectedMods); sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection"); @@ -84,7 +83,7 @@ namespace osu.Game.Screens.Select protected override void UpdateBeatmap(WorkingBeatmap beatmap) { - beatmap.Mods.BindTo(SelectedMods); + beatmap.Mods.BindTo(selectedMods); base.UpdateBeatmap(beatmap); @@ -131,7 +130,7 @@ namespace osu.Game.Screens.Select if (Beatmap.Value.Track != null) Beatmap.Value.Track.Looping = false; - SelectedMods.UnbindAll(); + selectedMods.UnbindAll(); Beatmap.Value.Mods.Value = new Mod[] { }; return false; @@ -147,10 +146,10 @@ namespace osu.Game.Screens.Select var auto = Ruleset.Value.CreateInstance().GetAutoplayMod(); var autoType = auto.GetType(); - var mods = modSelect.SelectedMods.Value; + var mods = selectedMods.Value; if (mods.All(m => m.GetType() != autoType)) { - modSelect.SelectedMods.Value = mods.Append(auto); + selectedMods.Value = mods.Append(auto); removeAutoModOnResume = true; } } From 4cb7063801e561a4e58494f30befec96d413f6eb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Aug 2018 16:45:18 +0900 Subject: [PATCH 289/304] Add automated testing of mod preservation/removal --- osu.Game.Tests/Visual/TestCaseMods.cs | 79 +++++++++++++--------- osu.Game/OsuGame.cs | 2 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 6 +- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- 4 files changed, 52 insertions(+), 37 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseMods.cs b/osu.Game.Tests/Visual/TestCaseMods.cs index 6330afe860..ab53dbd968 100644 --- a/osu.Game.Tests/Visual/TestCaseMods.cs +++ b/osu.Game.Tests/Visual/TestCaseMods.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.ComponentModel; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Overlays.Mods; @@ -13,12 +12,11 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Mods; using System.Linq; using System.Collections.Generic; +using NUnit.Framework; using osu.Framework.Configuration; -using osu.Game.Rulesets.Osu; using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Mods.Sections; -using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Mania.Mods; using osu.Game.Rulesets.UI; using OpenTK.Graphics; @@ -51,11 +49,6 @@ namespace osu.Game.Tests.Visual private void load(RulesetStore rulesets) { this.rulesets = rulesets; - } - - protected override void LoadComplete() - { - base.LoadComplete(); Add(modSelect = new TestModSelectOverlay { @@ -72,34 +65,25 @@ namespace osu.Game.Tests.Visual Position = new Vector2(0, 25), }); + modDisplay.Current.UnbindBindings(); modDisplay.Current.BindTo(modSelect.SelectedMods); - AddStep("Toggle", modSelect.ToggleVisibility); - AddStep("Hide", modSelect.Hide); AddStep("Show", modSelect.Show); - - foreach (var rulesetInfo in rulesets.AvailableRulesets) - { - Ruleset ruleset = rulesetInfo.CreateInstance(); - AddStep($"switch to {ruleset.Description}", () => Ruleset.Value = rulesetInfo); - - switch (ruleset) - { - case OsuRuleset or: - testOsuMods(or); - break; - case ManiaRuleset mr: - testManiaMods(mr); - break; - } - } + AddStep("Toggle", modSelect.ToggleVisibility); + AddStep("Toggle", modSelect.ToggleVisibility); } - private void testOsuMods(OsuRuleset ruleset) + [Test] + public void TestOsuMods() { - var easierMods = ruleset.GetModsFor(ModType.DifficultyReduction); - var harderMods = ruleset.GetModsFor(ModType.DifficultyIncrease); - var assistMods = ruleset.GetModsFor(ModType.Automation); + var ruleset = rulesets.AvailableRulesets.First(r => r.ID == 0); + AddStep("change ruleset", () => { Ruleset.Value = ruleset; }); + + var instance = ruleset.CreateInstance(); + + var easierMods = instance.GetModsFor(ModType.DifficultyReduction); + var harderMods = instance.GetModsFor(ModType.DifficultyIncrease); + var assistMods = instance.GetModsFor(ModType.Automation); var noFailMod = easierMods.FirstOrDefault(m => m is OsuModNoFail); var hiddenMod = harderMods.FirstOrDefault(m => m is OsuModHidden); @@ -121,9 +105,40 @@ namespace osu.Game.Tests.Visual testUnimplementedMod(autoPilotMod); } - private void testManiaMods(ManiaRuleset ruleset) + [Test] + public void TestManiaMods() { - testRankedText(ruleset.GetModsFor(ModType.Conversion).First(m => m is ManiaModRandom)); + var ruleset = rulesets.AvailableRulesets.First(r => r.ID == 3); + AddStep("change ruleset", () => { Ruleset.Value = ruleset; }); + + testRankedText(ruleset.CreateInstance().GetModsFor(ModType.Conversion).First(m => m is ManiaModRandom)); + } + + [Test] + public void TestRulesetChanges() + { + var rulesetOsu = rulesets.AvailableRulesets.First(r => r.ID == 0); + var rulesetMania = rulesets.AvailableRulesets.First(r => r.ID == 3); + + AddStep("change ruleset to null", () => { Ruleset.Value = null; }); + + var instance = rulesetOsu.CreateInstance(); + var easierMods = instance.GetModsFor(ModType.DifficultyReduction); + var noFailMod = easierMods.FirstOrDefault(m => m is OsuModNoFail); + + AddStep("set mods externally", () => { modDisplay.Current.Value = new[] { noFailMod }; }); + + AddStep("change ruleset to osu", () => { Ruleset.Value = rulesetOsu; }); + + AddAssert("ensure mods still selected", () => modDisplay.Current.Value.Single(m => m is OsuModNoFail) != null); + + AddStep("change ruleset to mania", () => { Ruleset.Value = rulesetMania; }); + + AddAssert("ensure mods not selected", () => !modDisplay.Current.Value.Any(m => m is OsuModNoFail)); + + AddStep("change ruleset to osu", () => { Ruleset.Value = rulesetOsu; }); + + AddAssert("ensure mods not selected", () => !modDisplay.Current.Value.Any()); } private void testSingleMod(Mod mod) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 69d1236126..4d9a12943f 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -99,7 +99,7 @@ namespace osu.Game private readonly List overlays = new List(); // todo: move this to SongSelect once Screen has the ability to unsuspend. - private readonly Bindable> selectedMods = new Bindable>(new List()); + private readonly Bindable> selectedMods = new Bindable>(new Mod[] { }); public OsuGame(string[] args = null) { diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 3f28b7ccfd..45703ac56d 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -39,11 +39,11 @@ namespace osu.Game.Overlays.Mods protected readonly FillFlowContainer ModSectionsContainer; - protected readonly Bindable> SelectedMods = new Bindable>(); + protected readonly Bindable> SelectedMods = new Bindable>(new Mod[] { }); protected readonly IBindable Ruleset = new Bindable(); - [BackgroundDependencyLoader] + [BackgroundDependencyLoader(true)] private void load(OsuColour colours, IBindable ruleset, AudioManager audio, Bindable> selectedMods) { LowMultiplierColour = colours.Red; @@ -51,7 +51,7 @@ namespace osu.Game.Overlays.Mods UnrankedLabel.Colour = colours.Blue; Ruleset.BindTo(ruleset); - SelectedMods.BindTo(selectedMods); + if (selectedMods != null) SelectedMods.BindTo(selectedMods); sampleOn = audio.Sample.Get(@"UI/check-on"); sampleOff = audio.Sample.Get(@"UI/check-off"); diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 7a832caf41..210c03f2d9 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -50,7 +50,7 @@ namespace osu.Game.Screens.Select private SampleChannel sampleConfirm; - private readonly Bindable> selectedMods = new Bindable>(new List()); + private readonly Bindable> selectedMods = new Bindable>(new Mod[] { }); [BackgroundDependencyLoader(true)] private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, Bindable> selectedMods) From 6379c70a68ae4369483f64b3cb3275a9b85d48c4 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 8 Aug 2018 11:28:44 +0900 Subject: [PATCH 290/304] Add some ticks --- osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs index fdc8f362f7..30318464de 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs @@ -71,7 +71,7 @@ namespace osu.Game.Rulesets.Mania.Tests private Drawable createHoldNoteDisplay(ScrollingDirection direction) { - var note = new HoldNote { StartTime = 999999999, Duration = 1000 }; + var note = new HoldNote { StartTime = 999999999, Duration = 5000 }; note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); return new ScrollingTestContainer(direction) From 31146fbc014f24630438ff1d5b0d96c3ab592bb5 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 8 Aug 2018 11:28:55 +0900 Subject: [PATCH 291/304] Add anchor/origin tests --- .../TestCaseNotes.cs | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs index 30318464de..a8b2b20fda 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs @@ -46,15 +46,20 @@ namespace osu.Game.Rulesets.Mania.Tests Spacing = new Vector2(20), Children = new[] { - createNoteDisplay(ScrollingDirection.Down), - createNoteDisplay(ScrollingDirection.Up), - createHoldNoteDisplay(ScrollingDirection.Down), - createHoldNoteDisplay(ScrollingDirection.Up), + createNoteDisplay(ScrollingDirection.Down, 1, out var note1), + createNoteDisplay(ScrollingDirection.Up, 2, out var note2), + createHoldNoteDisplay(ScrollingDirection.Down, 1, out var holdNote1), + createHoldNoteDisplay(ScrollingDirection.Up, 2, out var holdNote2), } }; + + AddAssert("note 1 facing downwards", () => verifyAnchors(note1, Anchor.y2)); + AddAssert("note 2 facing upwards", () => verifyAnchors(note2, Anchor.y0)); + AddAssert("hold note 1 facing downwards", () => verifyAnchors(holdNote1, Anchor.y2)); + AddAssert("hold note 2 facing upwards", () => verifyAnchors(holdNote2, Anchor.y0)); } - private Drawable createNoteDisplay(ScrollingDirection direction) + private Drawable createNoteDisplay(ScrollingDirection direction, int identifier, out DrawableNote hitObject) { var note = new Note { StartTime = 999999999 }; note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); @@ -62,14 +67,14 @@ namespace osu.Game.Rulesets.Mania.Tests return new ScrollingTestContainer(direction) { AutoSizeAxes = Axes.Both, - Child = new NoteContainer(direction, $"note, scrolling {direction.ToString().ToLowerInvariant()}") + Child = new NoteContainer(direction, $"note {identifier}, scrolling {direction.ToString().ToLowerInvariant()}") { - Child = new DrawableNote(note) { AccentColour = Color4.OrangeRed } + Child = hitObject = new DrawableNote(note) { AccentColour = Color4.OrangeRed } } }; } - private Drawable createHoldNoteDisplay(ScrollingDirection direction) + private Drawable createHoldNoteDisplay(ScrollingDirection direction, int identifier, out DrawableHoldNote hitObject) { var note = new HoldNote { StartTime = 999999999, Duration = 5000 }; note.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); @@ -77,9 +82,9 @@ namespace osu.Game.Rulesets.Mania.Tests return new ScrollingTestContainer(direction) { AutoSizeAxes = Axes.Both, - Child = new NoteContainer(direction, $"hold note, scrolling {direction.ToString().ToLowerInvariant()}") + Child = new NoteContainer(direction, $"hold note {identifier}, scrolling {direction.ToString().ToLowerInvariant()}") { - Child = new DrawableHoldNote(note) + Child = hitObject = new DrawableHoldNote(note) { RelativeSizeAxes = Axes.Both, AccentColour = Color4.OrangeRed, @@ -88,6 +93,12 @@ namespace osu.Game.Rulesets.Mania.Tests }; } + private bool verifyAnchors(DrawableHitObject hitObject, Anchor expectedAnchor) + => hitObject.Anchor.HasFlag(expectedAnchor) && hitObject.Origin.HasFlag(expectedAnchor); + + private bool verifyAnchors(DrawableHoldNote holdNote, Anchor expectedAnchor) + => verifyAnchors((DrawableHitObject)holdNote, expectedAnchor) && holdNote.NestedHitObjects.All(n => verifyAnchors(n, expectedAnchor)); + private class NoteContainer : Container { private readonly Container content; From dc7804983938cf6e721f4f1823576df8f968036a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 8 Aug 2018 12:21:44 +0900 Subject: [PATCH 292/304] Add test for propagation of direction through mania stack --- .../ScrollingTestContainer.cs | 22 ++++++++----------- .../TestCaseStage.cs | 21 ++++++++++++++++-- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs b/osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs index 5a93efb0dc..29663c2093 100644 --- a/osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs +++ b/osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs @@ -14,24 +14,20 @@ namespace osu.Game.Rulesets.Mania.Tests /// public class ScrollingTestContainer : Container { - private readonly ScrollingDirection direction; + [Cached(Type = typeof(IScrollingInfo))] + private readonly TestScrollingInfo scrollingInfo = new TestScrollingInfo(); public ScrollingTestContainer(ScrollingDirection direction) { - this.direction = direction; + scrollingInfo.Direction.Value = direction; } - protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) - { - var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - dependencies.CacheAs(new ScrollingInfo { Direction = { Value = direction }}); - return dependencies; - } + public void Flip() => scrollingInfo.Direction.Value = scrollingInfo.Direction.Value == ScrollingDirection.Up ? ScrollingDirection.Down : ScrollingDirection.Up; + } - private class ScrollingInfo : IScrollingInfo - { - public readonly Bindable Direction = new Bindable(); - IBindable IScrollingInfo.Direction => Direction; - } + public class TestScrollingInfo : IScrollingInfo + { + public readonly Bindable Direction = new Bindable(); + IBindable IScrollingInfo.Direction => Direction; } } diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs index b1bb7f5187..5c5d955168 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -24,6 +25,8 @@ namespace osu.Game.Rulesets.Mania.Tests private readonly List stages = new List(); + private FillFlowContainer fill; + public TestCaseStage() : base(columns) { @@ -32,7 +35,7 @@ namespace osu.Game.Rulesets.Mania.Tests [BackgroundDependencyLoader] private void load() { - Child = new FillFlowContainer + Child = fill = new FillFlowContainer { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, @@ -54,8 +57,22 @@ namespace osu.Game.Rulesets.Mania.Tests AddStep("hold note", createHoldNote); AddStep("minor bar line", () => createBarLine(false)); AddStep("major bar line", () => createBarLine(true)); + + AddAssert("check note anchors", () => notesInStageAreAnchored(stages[0], Anchor.TopCentre)); + AddAssert("check note anchors", () => notesInStageAreAnchored(stages[1], Anchor.BottomCentre)); + + AddStep("flip direction", () => + { + foreach (var c in fill.Children) + c.Flip(); + }); + + AddAssert("check note anchors", () => notesInStageAreAnchored(stages[0], Anchor.BottomCentre)); + AddAssert("check note anchors", () => notesInStageAreAnchored(stages[1], Anchor.TopCentre)); } + private bool notesInStageAreAnchored(ManiaStage stage, Anchor anchor) => stage.Columns.SelectMany(c => c.AllHitObjects).All(o => o.Anchor == anchor); + private void createNote() { foreach (var stage in stages) @@ -101,7 +118,7 @@ namespace osu.Game.Rulesets.Mania.Tests } } - private Drawable createStage(ScrollingDirection direction, ManiaAction action) + private ScrollingTestContainer createStage(ScrollingDirection direction, ManiaAction action) { var specialAction = ManiaAction.Special1; From 4453b5facafe6f41ebf1c1f041b180527ba32df4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 8 Aug 2018 12:26:57 +0900 Subject: [PATCH 293/304] Cache mods at PlaySongSelect --- osu.Game/OsuGame.cs | 2 ++ osu.Game/Screens/Select/PlaySongSelect.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4d9a12943f..5923037cd9 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -99,6 +99,8 @@ namespace osu.Game private readonly List overlays = new List(); // todo: move this to SongSelect once Screen has the ability to unsuspend. + [Cached] + [Cached(Type = typeof(IBindable>))] private readonly Bindable> selectedMods = new Bindable>(new Mod[] { }); public OsuGame(string[] args = null) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 210c03f2d9..e914eb365e 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -50,6 +50,8 @@ namespace osu.Game.Screens.Select private SampleChannel sampleConfirm; + [Cached] + [Cached(Type = typeof(IBindable>))] private readonly Bindable> selectedMods = new Bindable>(new Mod[] { }); [BackgroundDependencyLoader(true)] From bfbe00e6eca12dedfda65c1307788a55b5f3d6d8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 8 Aug 2018 15:38:09 +0900 Subject: [PATCH 294/304] Remove multiple caching --- osu.Game/OsuGame.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 5923037cd9..a1e385921f 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -155,9 +155,6 @@ namespace osu.Game dependencies.CacheAs(ruleset); dependencies.CacheAs>(ruleset); - dependencies.CacheAs(selectedMods); - dependencies.CacheAs>>(selectedMods); - // bind config int to database RulesetInfo configRuleset = LocalConfig.GetBindable(OsuSetting.Ruleset); ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First(); From 2a5b9f79ffb81964af128f23a1d6ef4f7660e7e0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 8 Aug 2018 15:49:27 +0900 Subject: [PATCH 295/304] Indent --- osu.Game/Overlays/Direct/DirectPanel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 5a73aab23e..322db0b7d6 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -128,7 +128,7 @@ namespace osu.Game.Overlays.Direct content.TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint); content.MoveToY(-4, hover_transition_time, Easing.OutQuint); if (FadePlayButton) - PlayButton.FadeIn(120, Easing.InOutQuint); + PlayButton.FadeIn(120, Easing.InOutQuint); return base.OnHover(state); } From b8824a41b583453e7ac6656b0f7e69028cb761fe Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Aug 2018 11:44:53 +0900 Subject: [PATCH 296/304] Fix certain control points not being replaced --- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 26f28c86ca..29be751de2 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -354,6 +354,11 @@ namespace osu.Game.Beatmaps.Formats private void handleTimingControlPoint(TimingControlPoint newPoint) { + var existing = beatmap.ControlPointInfo.TimingPointAt(newPoint.Time); + + if (existing.Time == newPoint.Time) + beatmap.ControlPointInfo.TimingPoints.Remove(existing); + beatmap.ControlPointInfo.TimingPoints.Add(newPoint); } @@ -364,7 +369,9 @@ namespace osu.Game.Beatmaps.Formats if (newPoint.EquivalentTo(existing)) return; - beatmap.ControlPointInfo.DifficultyPoints.RemoveAll(x => x.Time == newPoint.Time); + if (existing.Time == newPoint.Time) + beatmap.ControlPointInfo.DifficultyPoints.Remove(existing); + beatmap.ControlPointInfo.DifficultyPoints.Add(newPoint); } @@ -375,6 +382,9 @@ namespace osu.Game.Beatmaps.Formats if (newPoint.EquivalentTo(existing)) return; + if (existing.Time == newPoint.Time) + beatmap.ControlPointInfo.EffectPoints.Remove(existing); + beatmap.ControlPointInfo.EffectPoints.Add(newPoint); } @@ -385,6 +395,9 @@ namespace osu.Game.Beatmaps.Formats if (newPoint.EquivalentTo(existing)) return; + if (existing.Time == newPoint.Time) + beatmap.ControlPointInfo.SamplePoints.Remove(existing); + beatmap.ControlPointInfo.SamplePoints.Add(newPoint); } From 970aa811bda0dd5399de555c696665e6650ea751 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Aug 2018 13:19:50 +0900 Subject: [PATCH 297/304] Fix mods not being reset prior to ruleset changing --- osu.Game/Screens/Select/SongSelect.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 1bcd65e30b..54143bef8a 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -314,13 +314,13 @@ namespace osu.Game.Screens.Select { Logger.Log($"updating selection with beatmap:{beatmap?.ID.ToString() ?? "null"} ruleset:{ruleset?.ID.ToString() ?? "null"}"); - WorkingBeatmap working = Beatmap.Value; - bool preview = false; if (ruleset?.Equals(Ruleset.Value) == false) { Logger.Log($"ruleset changed from \"{Ruleset.Value}\" to \"{ruleset}\""); + + Beatmap.Value.Mods.Value = Enumerable.Empty(); Ruleset.Value = ruleset; // force a filter before attempting to change the beatmap. @@ -340,7 +340,7 @@ namespace osu.Game.Screens.Select Logger.Log($"beatmap changed from \"{Beatmap.Value.BeatmapInfo}\" to \"{beatmap}\""); preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID; - working = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value); + Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value); if (beatmap != null) { @@ -351,9 +351,6 @@ namespace osu.Game.Screens.Select } } - working.Mods.Value = Enumerable.Empty(); - Beatmap.Value = working; - ensurePlayingSelected(preview); UpdateBeatmap(Beatmap.Value); } From 15bd7e4f1f8e84af63442c24e54c586db5935787 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Aug 2018 14:18:46 +0900 Subject: [PATCH 298/304] Test that changing ruleset resets mods --- .../Visual/TestCasePlaySongSelect.cs | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index b1ffe04b68..1a74d21f53 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -8,11 +8,15 @@ using System.Linq; using System.Text; using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Extensions; using osu.Framework.MathUtils; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu.Mods; +using osu.Game.Rulesets.Taiko; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Carousel; using osu.Game.Screens.Select.Filter; @@ -29,6 +33,10 @@ namespace osu.Game.Tests.Visual private WorkingBeatmap defaultBeatmap; private DatabaseContextFactory factory; + [Cached] + [Cached(Type = typeof(IBindable>))] + private readonly Bindable> selectedMods = new Bindable>(new Mod[] { }); + public override IReadOnlyList RequiredTypes => new[] { typeof(SongSelect), @@ -49,6 +57,8 @@ namespace osu.Game.Tests.Visual private class TestSongSelect : PlaySongSelect { + public new Bindable Ruleset => base.Ruleset; + public WorkingBeatmap CurrentBeatmap => Beatmap.Value; public WorkingBeatmap CurrentBeatmapDetailsBeatmap => BeatmapDetails.Beatmap; public new BeatmapCarousel Carousel => base.Carousel; @@ -143,11 +153,42 @@ namespace osu.Game.Tests.Visual AddUntilStep(() => songSelect.Carousel.SelectedBeatmap == null, "no selection"); } + [Test] + public void TestRulesetChangeResetsMods() + { + changeRuleset(0); + + changeMods(new OsuModHardRock()); + + int actionIndex = 0; + int modChangeIndex = 0; + int rulesetChangeIndex = 0; + + AddStep("change ruleset", () => + { + songSelect.CurrentBeatmap.Mods.ValueChanged += onModChange; + songSelect.Ruleset.ValueChanged += onRulesetChange; + + Ruleset.Value = new TaikoRuleset().RulesetInfo; + + songSelect.CurrentBeatmap.Mods.ValueChanged -= onModChange; + songSelect.Ruleset.ValueChanged -= onRulesetChange; + }); + + AddAssert("mods changed before ruleset", () => modChangeIndex < rulesetChangeIndex); + AddAssert("empty mods", () => !selectedMods.Value.Any()); + + void onModChange(IEnumerable mods) => modChangeIndex = actionIndex++; + void onRulesetChange(RulesetInfo ruleset) => rulesetChangeIndex = actionIndex--; + } + private void importForRuleset(int id) => AddStep($"import test map for ruleset {id}", () => manager.Import(createTestBeatmapSet(getImportId(), rulesets.AvailableRulesets.Where(r => r.ID == id).ToArray()))); private static int importId; private int getImportId() => ++importId; + private void changeMods(params Mod[] mods) => AddStep($"change mods to {string.Join(", ", mods.Select(m => m.ShortenedName))}", () => selectedMods.Value = mods); + private void changeRuleset(int id) => AddStep($"change ruleset to {id}", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == id)); private void addManyTestMaps() From 78258e2fe287e92efca118f122955b237e2d7cc8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Aug 2018 14:19:26 +0900 Subject: [PATCH 299/304] Prefix some methods with "Test" --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 1a74d21f53..888bf6250f 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -131,7 +131,7 @@ namespace osu.Game.Tests.Visual [Test] [Ignore("needs fixing")] - public void ImportUnderDifferentRuleset() + public void TestImportUnderDifferentRuleset() { changeRuleset(2); importForRuleset(0); @@ -139,7 +139,7 @@ namespace osu.Game.Tests.Visual } [Test] - public void ImportUnderCurrentRuleset() + public void TestImportUnderCurrentRuleset() { changeRuleset(2); importForRuleset(2); From 7971d06df1840dec0966f29ed8e0b98029d2a9a0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Aug 2018 14:27:47 +0900 Subject: [PATCH 300/304] Remove AlwaysPresent --- .../Objects/Drawables/DrawableStrongHandler.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs index 45a853b94b..6408b7b369 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs @@ -17,8 +17,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables : base(strong) { MainObject = mainObject; - - AlwaysPresent = true; } protected override void UpdateState(ArmedState state) From 732dfde8edb6ed5b4da6931405e08b67ecc704c7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Aug 2018 14:28:05 +0900 Subject: [PATCH 301/304] DrawableStrongHandler -> DrawableNestedStrongHit --- osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs | 6 +++--- .../Objects/Drawables/DrawableDrumRoll.cs | 6 +++--- .../Objects/Drawables/DrawableDrumRollTick.cs | 6 +++--- osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs | 6 +++--- .../Objects/Drawables/DrawableStrongHandler.cs | 4 ++-- .../Objects/Drawables/DrawableTaikoHitObject.cs | 4 ++-- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs index b002c2abab..fc103e4c72 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs @@ -155,7 +155,7 @@ namespace osu.Game.Rulesets.Taiko.Tests var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) }; ((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult }); - ((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(new TestStrongHandler(h), new JudgementResult(new TaikoStrongJudgement()) { Type = HitResult.Great }); + ((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(new TestStrongNestedHit(h), new JudgementResult(new TaikoStrongJudgement()) { Type = HitResult.Great }); } private void addMissJudgement() @@ -226,9 +226,9 @@ namespace osu.Game.Rulesets.Taiko.Tests rulesetContainer.Playfield.Add(new DrawableRimHit(h)); } - private class TestStrongHandler : DrawableStrongHandler + private class TestStrongNestedHit : DrawableStrongNestedHit { - public TestStrongHandler(DrawableHitObject mainObject) + public TestStrongNestedHit(DrawableHitObject mainObject) : base(null, mainObject) { } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs index 0fb2405f77..5142f125ac 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -99,11 +99,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables } } - protected override DrawableStrongHandler CreateStrongHandler(StrongHitObject hitObject) => new StrongHandler(hitObject, this); + protected override DrawableStrongNestedHit CreateStrongHit(StrongHitObject hitObject) => new StrongNestedHit(hitObject, this); - private class StrongHandler : DrawableStrongHandler + private class StrongNestedHit : DrawableStrongNestedHit { - public StrongHandler(StrongHitObject strong, DrawableDrumRoll drumRoll) + public StrongNestedHit(StrongHitObject strong, DrawableDrumRoll drumRoll) : base(strong, drumRoll) { } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs index ff1cce24b6..a70d7bde0e 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs @@ -51,11 +51,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables public override bool OnPressed(TaikoAction action) => UpdateResult(true); - protected override DrawableStrongHandler CreateStrongHandler(StrongHitObject hitObject) => new StrongHandler(hitObject, this); + protected override DrawableStrongNestedHit CreateStrongHit(StrongHitObject hitObject) => new StrongNestedHit(hitObject, this); - private class StrongHandler : DrawableStrongHandler + private class StrongNestedHit : DrawableStrongNestedHit { - public StrongHandler(StrongHitObject strong, DrawableDrumRollTick tick) + public StrongNestedHit(StrongHitObject strong, DrawableDrumRollTick tick) : base(strong, tick) { } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 6181b74822..f59dc8c1ee 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -127,9 +127,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables } } - protected override DrawableStrongHandler CreateStrongHandler(StrongHitObject hitObject) => new StrongHandler(hitObject, this); + protected override DrawableStrongNestedHit CreateStrongHit(StrongHitObject hitObject) => new StrongNestedHit(hitObject, this); - private class StrongHandler : DrawableStrongHandler + private class StrongNestedHit : DrawableStrongNestedHit { /// /// The lenience for the second key press. @@ -139,7 +139,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables public new DrawableHit MainObject => (DrawableHit)base.MainObject; - public StrongHandler(StrongHitObject strong, DrawableHit hit) + public StrongNestedHit(StrongHitObject strong, DrawableHit hit) : base(strong, hit) { } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs index 6408b7b369..b27de3832a 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs @@ -9,11 +9,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables /// /// Used as a nested hitobject to provide s for s. /// - public abstract class DrawableStrongHandler : DrawableTaikoHitObject + public abstract class DrawableStrongNestedHit : DrawableTaikoHitObject { public readonly DrawableHitObject MainObject; - protected DrawableStrongHandler(StrongHitObject strong, DrawableHitObject mainObject) + protected DrawableStrongNestedHit(StrongHitObject strong, DrawableHitObject mainObject) : base(strong) { MainObject = mainObject; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 6d19c99b9c..bb63bd58cf 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -105,7 +105,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables var strongObject = HitObject.NestedHitObjects.OfType().FirstOrDefault(); if (strongObject != null) { - var vis = CreateStrongHandler(strongObject); + var vis = CreateStrongHit(strongObject); if (vis != null) { AddNested(vis); @@ -127,6 +127,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables /// /// The strong hitobject. /// The strong hitobject handler. - protected virtual DrawableStrongHandler CreateStrongHandler(StrongHitObject hitObject) => null; + protected virtual DrawableStrongNestedHit CreateStrongHit(StrongHitObject hitObject) => null; } } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 8973a4ef35..325beb38a5 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -236,7 +236,7 @@ namespace osu.Game.Rulesets.Taiko.UI { case TaikoStrongJudgement _: if (result.IsHit) - hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongHandler)judgedObject).MainObject)?.VisualiseSecondHit(); + hitExplosionContainer.Children.FirstOrDefault(e => e.JudgedObject == ((DrawableStrongNestedHit)judgedObject).MainObject)?.VisualiseSecondHit(); break; default: judgementContainer.Add(new DrawableTaikoJudgement(result, judgedObject) From 1a355063866132f4a63dc478b4c7d1e0471eff02 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Aug 2018 14:29:49 +0900 Subject: [PATCH 302/304] Cleanup strong hit construction --- .../Objects/Drawables/DrawableTaikoHitObject.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index bb63bd58cf..51e39dc648 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -105,12 +105,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables var strongObject = HitObject.NestedHitObjects.OfType().FirstOrDefault(); if (strongObject != null) { - var vis = CreateStrongHit(strongObject); - if (vis != null) - { - AddNested(vis); - AddInternal(vis); - } + var strongHit = CreateStrongHit(strongObject); + + AddNested(strongHit); + AddInternal(strongHit); } } From b045f5c9b6c19816d6b9577a895586567c406215 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Aug 2018 14:32:06 +0900 Subject: [PATCH 303/304] Adjust filename --- .../{DrawableStrongHandler.cs => DrawableStrongNestedHit.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename osu.Game.Rulesets.Taiko/Objects/Drawables/{DrawableStrongHandler.cs => DrawableStrongNestedHit.cs} (100%) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongNestedHit.cs similarity index 100% rename from osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongHandler.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableStrongNestedHit.cs From e360985d732ca356017394c6f19de60424fcc2e1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 14 Aug 2018 18:15:09 +0900 Subject: [PATCH 304/304] Replace variables into the entire line --- .../Formats/LegacyStoryboardDecoderTest.cs | 14 ++++++++++++++ osu.Game.Tests/Resources/variable-with-suffix.osb | 5 +++++ .../Beatmaps/Formats/LegacyStoryboardDecoder.cs | 11 +++-------- 3 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 osu.Game.Tests/Resources/variable-with-suffix.osb diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyStoryboardDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyStoryboardDecoderTest.cs index 3431be91f9..82adc88c6b 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyStoryboardDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyStoryboardDecoderTest.cs @@ -86,5 +86,19 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.AreEqual(78993, animation.StartTime); } } + + [Test] + public void TestDecodeVariableWithSuffix() + { + var decoder = new LegacyStoryboardDecoder(); + using (var resStream = Resource.OpenResource("variable-with-suffix.osb")) + using (var stream = new StreamReader(resStream)) + { + var storyboard = decoder.Decode(stream); + + StoryboardLayer background = storyboard.Layers.Single(l => l.Depth == 3); + Assert.AreEqual(123456, ((StoryboardSprite)background.Elements.Single()).InitialPosition.X); + } + } } } diff --git a/osu.Game.Tests/Resources/variable-with-suffix.osb b/osu.Game.Tests/Resources/variable-with-suffix.osb new file mode 100644 index 0000000000..5c9b46ca98 --- /dev/null +++ b/osu.Game.Tests/Resources/variable-with-suffix.osb @@ -0,0 +1,5 @@ +[Variables] +$var=1234 + +[Events] +Sprite,Background,TopCentre,"img.jpg",$var56,240 diff --git a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs index b418cbd5ec..a8a62013b1 100644 --- a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs @@ -289,15 +289,10 @@ namespace osu.Game.Beatmaps.Formats while (line.IndexOf('$') >= 0) { string origLine = line; - string[] split = line.Split(','); - for (int i = 0; i < split.Length; i++) - { - var item = split[i]; - if (item.StartsWith("$") && variables.ContainsKey(item)) - split[i] = variables[item]; - } - line = string.Join(",", split); + foreach (var v in variables) + line = line.Replace(v.Key, v.Value); + if (line == origLine) break; }