From b3d834731586f16cff8ea513ab1a361283b38078 Mon Sep 17 00:00:00 2001 From: Firmatorenio Date: Thu, 10 Dec 2020 20:11:08 +0600 Subject: [PATCH 01/35] add support for ScorePosition into LegacyManiaSkin --- osu.Game/Skinning/LegacyManiaSkinConfiguration.cs | 1 + osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs | 1 + osu.Game/Skinning/LegacyManiaSkinDecoder.cs | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/osu.Game/Skinning/LegacyManiaSkinConfiguration.cs b/osu.Game/Skinning/LegacyManiaSkinConfiguration.cs index 35a6140cbc..a8225a5bea 100644 --- a/osu.Game/Skinning/LegacyManiaSkinConfiguration.cs +++ b/osu.Game/Skinning/LegacyManiaSkinConfiguration.cs @@ -35,6 +35,7 @@ namespace osu.Game.Skinning public float HitPosition = (480 - 402) * POSITION_SCALE_FACTOR; public float LightPosition = (480 - 413) * POSITION_SCALE_FACTOR; + public float ScorePosition = (480 - 402 + 150) * POSITION_SCALE_FACTOR; public bool ShowJudgementLine = true; public bool KeysUnderNotes; diff --git a/osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs b/osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs index a99710ea96..9db6c8bf66 100644 --- a/osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs +++ b/osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs @@ -25,6 +25,7 @@ namespace osu.Game.Skinning LeftLineWidth, RightLineWidth, HitPosition, + ScorePosition, LightPosition, HitTargetImage, ShowJudgementLine, diff --git a/osu.Game/Skinning/LegacyManiaSkinDecoder.cs b/osu.Game/Skinning/LegacyManiaSkinDecoder.cs index 3dbec23194..49feb9c3f0 100644 --- a/osu.Game/Skinning/LegacyManiaSkinDecoder.cs +++ b/osu.Game/Skinning/LegacyManiaSkinDecoder.cs @@ -94,6 +94,10 @@ namespace osu.Game.Skinning currentConfig.LightPosition = (480 - float.Parse(pair.Value, CultureInfo.InvariantCulture)) * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR; break; + case "ScorePosition": + currentConfig.ScorePosition = (480 - float.Parse(pair.Value, CultureInfo.InvariantCulture)) * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR; + break; + case "JudgementLine": currentConfig.ShowJudgementLine = pair.Value == "1"; break; From 60379b09dbc22a1b8229c45a5a74a8f384a2bb39 Mon Sep 17 00:00:00 2001 From: Firmatorenio Date: Sun, 13 Dec 2020 18:14:41 +0600 Subject: [PATCH 02/35] added a container for the judgements to move up or down --- ...awableManiaJudgementAdjustmentContainer.cs | 23 +++++++++++++++++++ osu.Game.Rulesets.Mania/UI/Stage.cs | 8 +------ 2 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/UI/DrawableManiaJudgementAdjustmentContainer.cs diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgementAdjustmentContainer.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgementAdjustmentContainer.cs new file mode 100644 index 0000000000..b5abd9fb10 --- /dev/null +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgementAdjustmentContainer.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Text; +using osu.Game.Rulesets.UI; +using osu.Framework.Graphics; + +namespace osu.Game.Rulesets.Mania.UI +{ + public class DrawableManiaJudgementAdjustmentContainer : JudgementContainer + { + private float scorePosition => 0; + public DrawableManiaJudgementAdjustmentContainer(float hitTargetPosition) + { + Anchor = Anchor.TopCentre; + Origin = Anchor.Centre; + RelativeSizeAxes = Axes.Both; + Y = hitTargetPosition + 150; + } + + public DrawableManiaJudgementAdjustmentContainer() + : this(110) { } + } +} diff --git a/osu.Game.Rulesets.Mania/UI/Stage.cs b/osu.Game.Rulesets.Mania/UI/Stage.cs index 3d7960ffe3..73af205a37 100644 --- a/osu.Game.Rulesets.Mania/UI/Stage.cs +++ b/osu.Game.Rulesets.Mania/UI/Stage.cs @@ -101,13 +101,7 @@ namespace osu.Game.Rulesets.Mania.UI { RelativeSizeAxes = Axes.Both }, - judgements = new JudgementContainer - { - Anchor = Anchor.TopCentre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Y = HIT_TARGET_POSITION + 150, - }, + judgements = new DrawableManiaJudgementAdjustmentContainer(HIT_TARGET_POSITION), topLevelContainer = new Container { RelativeSizeAxes = Axes.Both } } } From 7d2b77cdbdf2f09b5c4938d3c87fe5b181682ab8 Mon Sep 17 00:00:00 2001 From: Graham Johnson Date: Sun, 13 Dec 2020 07:58:58 -0500 Subject: [PATCH 03/35] improve selection box rotation UX --- .../Screens/Edit/Compose/Components/SelectionBox.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs b/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs index 742d433760..347d9e3ba7 100644 --- a/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs +++ b/osu.Game/Screens/Edit/Compose/Components/SelectionBox.cs @@ -191,7 +191,7 @@ namespace osu.Game.Screens.Edit.Compose.Components { Anchor = Anchor.TopCentre, Y = -separation, - HandleDrag = e => OnRotation?.Invoke(e.Delta.X), + HandleDrag = e => OnRotation?.Invoke(convertDragEventToAngleOfRotation(e)), OperationStarted = operationStarted, OperationEnded = operationEnded } @@ -242,6 +242,15 @@ namespace osu.Game.Screens.Edit.Compose.Components private int activeOperations; + private float convertDragEventToAngleOfRotation(DragEvent e) + { + // Adjust coordinate system to the center of SelectionBox + float startAngle = MathF.Atan2(e.LastMousePosition.Y - DrawHeight / 2, e.LastMousePosition.X - DrawWidth / 2); + float endAngle = MathF.Atan2(e.MousePosition.Y - DrawHeight / 2, e.MousePosition.X - DrawWidth / 2); + + return (endAngle - startAngle) * 180 / MathF.PI; + } + private void operationEnded() { if (--activeOperations == 0) From f14e49c72e9dada5dc4771b15dd209528cc8ddef Mon Sep 17 00:00:00 2001 From: Firmatorenio Date: Sun, 13 Dec 2020 19:59:34 +0600 Subject: [PATCH 04/35] fetch ScorePosition from the skin --- ...awableManiaJudgementAdjustmentContainer.cs | 29 +++++++++++++++---- osu.Game.Rulesets.Mania/UI/Stage.cs | 15 ++++++++-- .../UI/Scrolling/ScrollingPlayfield.cs | 14 ++++++++- 3 files changed, 49 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgementAdjustmentContainer.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgementAdjustmentContainer.cs index b5abd9fb10..79e7d58f63 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgementAdjustmentContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgementAdjustmentContainer.cs @@ -8,16 +8,33 @@ namespace osu.Game.Rulesets.Mania.UI { public class DrawableManiaJudgementAdjustmentContainer : JudgementContainer { - private float scorePosition => 0; - public DrawableManiaJudgementAdjustmentContainer(float hitTargetPosition) + private float hitTargetPosition = 110; + private float scorePosition; + + public float HitTargetPosition + { + get => hitTargetPosition; + set + { + hitTargetPosition = value; + Y = value + scorePosition + 150; + } + } + + public float ScorePosition + { + set + { + scorePosition = value; + Y = hitTargetPosition + value + 150; + } + } + + public DrawableManiaJudgementAdjustmentContainer() { Anchor = Anchor.TopCentre; Origin = Anchor.Centre; RelativeSizeAxes = Axes.Both; - Y = hitTargetPosition + 150; } - - public DrawableManiaJudgementAdjustmentContainer() - : this(110) { } } } diff --git a/osu.Game.Rulesets.Mania/UI/Stage.cs b/osu.Game.Rulesets.Mania/UI/Stage.cs index 73af205a37..d06e341744 100644 --- a/osu.Game.Rulesets.Mania/UI/Stage.cs +++ b/osu.Game.Rulesets.Mania/UI/Stage.cs @@ -10,6 +10,7 @@ using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; +using osu.Game.Rulesets.Mania.Skinning; using osu.Game.Rulesets.Mania.UI.Components; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; @@ -32,7 +33,7 @@ namespace osu.Game.Rulesets.Mania.UI public IReadOnlyList Columns => columnFlow.Content; private readonly ColumnFlow columnFlow; - private readonly JudgementContainer judgements; + private DrawableManiaJudgementAdjustmentContainer judgements; private readonly DrawablePool judgementPool; private readonly Drawable barLineContainer; @@ -101,7 +102,10 @@ namespace osu.Game.Rulesets.Mania.UI { RelativeSizeAxes = Axes.Both }, - judgements = new DrawableManiaJudgementAdjustmentContainer(HIT_TARGET_POSITION), + judgements = new DrawableManiaJudgementAdjustmentContainer() + { + HitTargetPosition = HIT_TARGET_POSITION, + }, topLevelContainer = new Container { RelativeSizeAxes = Axes.Both } } } @@ -175,6 +179,13 @@ namespace osu.Game.Rulesets.Mania.UI })); } + protected override void OnSkinChanged() + { + judgements.ScorePosition = CurrentSkin.GetConfig( + new ManiaSkinConfigurationLookup(LegacyManiaSkinConfigurationLookups.ScorePosition)) + ?.Value ?? 0; + } + protected override void Update() { // Due to masking differences, it is not possible to get the width of the columns container automatically diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index 9dac3f4de1..e611f09dcf 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Skinning; using osuTK; namespace osu.Game.Rulesets.UI.Scrolling @@ -18,10 +19,21 @@ namespace osu.Game.Rulesets.UI.Scrolling [Resolved] protected IScrollingInfo ScrollingInfo { get; private set; } + protected ISkinSource CurrentSkin; + [BackgroundDependencyLoader] - private void load() + private void load(ISkinSource skin) { Direction.BindTo(ScrollingInfo.Direction); + CurrentSkin = skin; + + skin.SourceChanged += OnSkinChanged; + OnSkinChanged(); + } + + protected virtual void OnSkinChanged() + { + } /// From 21088443199777bc68cbd7f502468435cc9e29d3 Mon Sep 17 00:00:00 2001 From: Firmatorenio Date: Sun, 13 Dec 2020 22:00:46 +0600 Subject: [PATCH 05/35] apply ScorePosition to the judgement container --- osu.Game.Rulesets.Mania/UI/Stage.cs | 5 ++--- osu.Game/Skinning/LegacyManiaSkinConfiguration.cs | 2 +- osu.Game/Skinning/LegacySkin.cs | 3 +++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Mania/UI/Stage.cs b/osu.Game.Rulesets.Mania/UI/Stage.cs index d06e341744..db344a6934 100644 --- a/osu.Game.Rulesets.Mania/UI/Stage.cs +++ b/osu.Game.Rulesets.Mania/UI/Stage.cs @@ -181,9 +181,8 @@ namespace osu.Game.Rulesets.Mania.UI protected override void OnSkinChanged() { - judgements.ScorePosition = CurrentSkin.GetConfig( - new ManiaSkinConfigurationLookup(LegacyManiaSkinConfigurationLookups.ScorePosition)) - ?.Value ?? 0; + judgements.ScorePosition = CurrentSkin.GetManiaSkinConfig(LegacyManiaSkinConfigurationLookups.ScorePosition) + ?.Value ?? 0; } protected override void Update() diff --git a/osu.Game/Skinning/LegacyManiaSkinConfiguration.cs b/osu.Game/Skinning/LegacyManiaSkinConfiguration.cs index a8225a5bea..40588f0ac4 100644 --- a/osu.Game/Skinning/LegacyManiaSkinConfiguration.cs +++ b/osu.Game/Skinning/LegacyManiaSkinConfiguration.cs @@ -35,7 +35,7 @@ namespace osu.Game.Skinning public float HitPosition = (480 - 402) * POSITION_SCALE_FACTOR; public float LightPosition = (480 - 413) * POSITION_SCALE_FACTOR; - public float ScorePosition = (480 - 402 + 150) * POSITION_SCALE_FACTOR; + public float ScorePosition = (480 - 300) * POSITION_SCALE_FACTOR; public bool ShowJudgementLine = true; public bool KeysUnderNotes; diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index 63a22eba62..80b2fef35c 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -169,6 +169,9 @@ namespace osu.Game.Skinning case LegacyManiaSkinConfigurationLookups.HitPosition: return SkinUtils.As(new Bindable(existing.HitPosition)); + case LegacyManiaSkinConfigurationLookups.ScorePosition: + return SkinUtils.As(new Bindable(existing.ScorePosition)); + case LegacyManiaSkinConfigurationLookups.LightPosition: return SkinUtils.As(new Bindable(existing.LightPosition)); From 3741c2339a084244f98623b83b8cd71c35fe5d70 Mon Sep 17 00:00:00 2001 From: Firmatorenio Date: Sun, 13 Dec 2020 22:43:36 +0600 Subject: [PATCH 06/35] simplify implementation and adjust the default values --- ...awableManiaJudgementAdjustmentContainer.cs | 40 ------------------- osu.Game.Rulesets.Mania/UI/Stage.cs | 12 +++--- .../Skinning/LegacyManiaSkinConfiguration.cs | 2 +- osu.Game/Skinning/LegacyManiaSkinDecoder.cs | 2 +- 4 files changed, 9 insertions(+), 47 deletions(-) delete mode 100644 osu.Game.Rulesets.Mania/UI/DrawableManiaJudgementAdjustmentContainer.cs diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgementAdjustmentContainer.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgementAdjustmentContainer.cs deleted file mode 100644 index 79e7d58f63..0000000000 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgementAdjustmentContainer.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using osu.Game.Rulesets.UI; -using osu.Framework.Graphics; - -namespace osu.Game.Rulesets.Mania.UI -{ - public class DrawableManiaJudgementAdjustmentContainer : JudgementContainer - { - private float hitTargetPosition = 110; - private float scorePosition; - - public float HitTargetPosition - { - get => hitTargetPosition; - set - { - hitTargetPosition = value; - Y = value + scorePosition + 150; - } - } - - public float ScorePosition - { - set - { - scorePosition = value; - Y = hitTargetPosition + value + 150; - } - } - - public DrawableManiaJudgementAdjustmentContainer() - { - Anchor = Anchor.TopCentre; - Origin = Anchor.Centre; - RelativeSizeAxes = Axes.Both; - } - } -} diff --git a/osu.Game.Rulesets.Mania/UI/Stage.cs b/osu.Game.Rulesets.Mania/UI/Stage.cs index db344a6934..7d6ddce815 100644 --- a/osu.Game.Rulesets.Mania/UI/Stage.cs +++ b/osu.Game.Rulesets.Mania/UI/Stage.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Mania.UI public IReadOnlyList Columns => columnFlow.Content; private readonly ColumnFlow columnFlow; - private DrawableManiaJudgementAdjustmentContainer judgements; + private JudgementContainer judgements; private readonly DrawablePool judgementPool; private readonly Drawable barLineContainer; @@ -102,9 +102,11 @@ namespace osu.Game.Rulesets.Mania.UI { RelativeSizeAxes = Axes.Both }, - judgements = new DrawableManiaJudgementAdjustmentContainer() + judgements = new JudgementContainer() { - HitTargetPosition = HIT_TARGET_POSITION, + Anchor = Anchor.TopCentre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, }, topLevelContainer = new Container { RelativeSizeAxes = Axes.Both } } @@ -181,8 +183,8 @@ namespace osu.Game.Rulesets.Mania.UI protected override void OnSkinChanged() { - judgements.ScorePosition = CurrentSkin.GetManiaSkinConfig(LegacyManiaSkinConfigurationLookups.ScorePosition) - ?.Value ?? 0; + judgements.Y = CurrentSkin.GetManiaSkinConfig(LegacyManiaSkinConfigurationLookups.ScorePosition) + ?.Value ?? HIT_TARGET_POSITION + 150; } protected override void Update() diff --git a/osu.Game/Skinning/LegacyManiaSkinConfiguration.cs b/osu.Game/Skinning/LegacyManiaSkinConfiguration.cs index 40588f0ac4..77d390875b 100644 --- a/osu.Game/Skinning/LegacyManiaSkinConfiguration.cs +++ b/osu.Game/Skinning/LegacyManiaSkinConfiguration.cs @@ -35,7 +35,7 @@ namespace osu.Game.Skinning public float HitPosition = (480 - 402) * POSITION_SCALE_FACTOR; public float LightPosition = (480 - 413) * POSITION_SCALE_FACTOR; - public float ScorePosition = (480 - 300) * POSITION_SCALE_FACTOR; + public float ScorePosition = 300 * POSITION_SCALE_FACTOR; public bool ShowJudgementLine = true; public bool KeysUnderNotes; diff --git a/osu.Game/Skinning/LegacyManiaSkinDecoder.cs b/osu.Game/Skinning/LegacyManiaSkinDecoder.cs index 49feb9c3f0..6a04a95040 100644 --- a/osu.Game/Skinning/LegacyManiaSkinDecoder.cs +++ b/osu.Game/Skinning/LegacyManiaSkinDecoder.cs @@ -95,7 +95,7 @@ namespace osu.Game.Skinning break; case "ScorePosition": - currentConfig.ScorePosition = (480 - float.Parse(pair.Value, CultureInfo.InvariantCulture)) * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR; + currentConfig.ScorePosition = (float.Parse(pair.Value, CultureInfo.InvariantCulture)) * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR; break; case "JudgementLine": From cf7303e07231f2df157207a67e91578c59e3c6f4 Mon Sep 17 00:00:00 2001 From: Firmatorenio Date: Sun, 13 Dec 2020 22:54:01 +0600 Subject: [PATCH 07/35] dotnet format --- osu.Game.Rulesets.Mania/UI/Stage.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/UI/Stage.cs b/osu.Game.Rulesets.Mania/UI/Stage.cs index 7d6ddce815..d2f5e6902a 100644 --- a/osu.Game.Rulesets.Mania/UI/Stage.cs +++ b/osu.Game.Rulesets.Mania/UI/Stage.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Mania.UI public IReadOnlyList Columns => columnFlow.Content; private readonly ColumnFlow columnFlow; - private JudgementContainer judgements; + private readonly JudgementContainer judgements; private readonly DrawablePool judgementPool; private readonly Drawable barLineContainer; @@ -102,7 +102,7 @@ namespace osu.Game.Rulesets.Mania.UI { RelativeSizeAxes = Axes.Both }, - judgements = new JudgementContainer() + judgements = new JudgementContainer { Anchor = Anchor.TopCentre, Origin = Anchor.Centre, From c83c3e92fcebfe9793633ed1b55fa330ab4028a0 Mon Sep 17 00:00:00 2001 From: Firmatorenio Date: Mon, 14 Dec 2020 01:50:25 +0600 Subject: [PATCH 08/35] apply a private setter in a protected property --- osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index e611f09dcf..7259bf293c 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -18,8 +18,7 @@ namespace osu.Game.Rulesets.UI.Scrolling [Resolved] protected IScrollingInfo ScrollingInfo { get; private set; } - - protected ISkinSource CurrentSkin; + protected ISkinSource CurrentSkin { get; private set; } [BackgroundDependencyLoader] private void load(ISkinSource skin) From beee9b89d53806803a45a87462c2711daa689225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 13 Dec 2020 19:29:41 +0100 Subject: [PATCH 09/35] Change bar line SHOC to nested playfield --- .../UI/BarLinePlayfield.cs | 11 ++++ osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 62 ++++++++++++++++--- 2 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 osu.Game.Rulesets.Taiko/UI/BarLinePlayfield.cs diff --git a/osu.Game.Rulesets.Taiko/UI/BarLinePlayfield.cs b/osu.Game.Rulesets.Taiko/UI/BarLinePlayfield.cs new file mode 100644 index 0000000000..83d0a17e09 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/UI/BarLinePlayfield.cs @@ -0,0 +1,11 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Rulesets.UI.Scrolling; + +namespace osu.Game.Rulesets.Taiko.UI +{ + public class BarLinePlayfield : ScrollingPlayfield + { + } +} diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 370760f03e..d20b190c86 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -10,6 +10,7 @@ using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI.Scrolling; @@ -38,10 +39,15 @@ namespace osu.Game.Rulesets.Taiko.UI private SkinnableDrawable mascot; private ProxyContainer topLevelHitContainer; - private ScrollingHitObjectContainer barlineContainer; private Container rightArea; private Container leftArea; + /// + /// is purposefully not called on this to prevent i.e. being able to interact + /// with bar lines in the editor. + /// + private BarLinePlayfield barLinePlayfield; + private Container hitTargetOffsetContent; public TaikoPlayfield(ControlPointInfo controlPoints) @@ -84,7 +90,7 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - barlineContainer = new ScrollingHitObjectContainer(), + barLinePlayfield = new BarLinePlayfield(), new Container { Name = "Hit objects", @@ -155,12 +161,50 @@ namespace osu.Game.Rulesets.Taiko.UI mascot.Scale = new Vector2(DrawHeight / DEFAULT_HEIGHT); } + #region Pooling support + + public override void Add(HitObject h) + { + switch (h) + { + case BarLine barLine: + barLinePlayfield.Add(barLine); + break; + + case TaikoHitObject taikoHitObject: + base.Add(taikoHitObject); + break; + + default: + throw new ArgumentException($"Unsupported {nameof(HitObject)} type: {h.GetType()}"); + } + } + + public override bool Remove(HitObject h) + { + switch (h) + { + case BarLine barLine: + return barLinePlayfield.Remove(barLine); + + case TaikoHitObject taikoHitObject: + return base.Remove(taikoHitObject); + + default: + throw new ArgumentException($"Unsupported {nameof(HitObject)} type: {h.GetType()}"); + } + } + + #endregion + + #region Non-pooling support + public override void Add(DrawableHitObject h) { switch (h) { - case DrawableBarLine barline: - barlineContainer.Add(barline); + case DrawableBarLine barLine: + barLinePlayfield.Add(barLine); break; case DrawableTaikoHitObject taikoObject: @@ -170,7 +214,7 @@ namespace osu.Game.Rulesets.Taiko.UI break; default: - throw new ArgumentException($"Unsupported {nameof(DrawableHitObject)} type"); + throw new ArgumentException($"Unsupported {nameof(DrawableHitObject)} type: {h.GetType()}"); } } @@ -178,8 +222,8 @@ namespace osu.Game.Rulesets.Taiko.UI { switch (h) { - case DrawableBarLine barline: - return barlineContainer.Remove(barline); + case DrawableBarLine barLine: + return barLinePlayfield.Remove(barLine); case DrawableTaikoHitObject _: h.OnNewResult -= OnNewResult; @@ -187,10 +231,12 @@ namespace osu.Game.Rulesets.Taiko.UI return base.Remove(h); default: - throw new ArgumentException($"Unsupported {nameof(DrawableHitObject)} type"); + throw new ArgumentException($"Unsupported {nameof(DrawableHitObject)} type: {h.GetType()}"); } } + #endregion + internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result) { if (!DisplayJudgements.Value) From f83c5fa81d8f5291e0c3d75b37e65a35ec8b2a8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 13 Dec 2020 19:38:32 +0100 Subject: [PATCH 10/35] Add backing bindable for major field --- osu.Game.Rulesets.Taiko/Objects/BarLine.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/BarLine.cs b/osu.Game.Rulesets.Taiko/Objects/BarLine.cs index 6306195704..bbfc02f975 100644 --- a/osu.Game.Rulesets.Taiko/Objects/BarLine.cs +++ b/osu.Game.Rulesets.Taiko/Objects/BarLine.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Bindables; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; @@ -8,7 +9,13 @@ namespace osu.Game.Rulesets.Taiko.Objects { public class BarLine : TaikoHitObject, IBarLine { - public bool Major { get; set; } + public bool Major + { + get => MajorBindable.Value; + set => MajorBindable.Value = value; + } + + public readonly Bindable MajorBindable = new BindableBool(); public override Judgement CreateJudgement() => new IgnoreJudgement(); } From a8e86a20e1aa127ff35bfdf244feeb32b63f685f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 13 Dec 2020 19:59:07 +0100 Subject: [PATCH 11/35] Unify bar line types & prepare for pooling --- .../Skinning/TestSceneDrawableBarLine.cs | 2 +- .../TestSceneHits.cs | 8 +- .../Objects/Drawables/DrawableBarLine.cs | 110 +++++++++++++++--- .../Objects/Drawables/DrawableBarLineMajor.cs | 67 ----------- .../UI/DrawableTaikoRuleset.cs | 2 +- 5 files changed, 102 insertions(+), 87 deletions(-) delete mode 100644 osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLineMajor.cs diff --git a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableBarLine.cs b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableBarLine.cs index f6aec20d53..ff309f278e 100644 --- a/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableBarLine.cs +++ b/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableBarLine.cs @@ -71,7 +71,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning } }; - hoc.Add(new DrawableBarLineMajor(createBarLineAtCurrentTime(true)) + hoc.Add(new DrawableBarLine(createBarLineAtCurrentTime(true)) { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneHits.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneHits.cs index c3fa03d404..18ee903977 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneHits.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneHits.cs @@ -145,9 +145,13 @@ namespace osu.Game.Rulesets.Taiko.Tests private void addBarLine(bool major, double delay = scroll_time) { - BarLine bl = new BarLine { StartTime = DrawableRuleset.Playfield.Time.Current + delay }; + BarLine bl = new BarLine + { + StartTime = DrawableRuleset.Playfield.Time.Current + delay, + Major = major + }; - DrawableRuleset.Playfield.Add(major ? new DrawableBarLineMajor(bl) : new DrawableBarLine(bl)); + DrawableRuleset.Playfield.Add(new DrawableBarLine(bl)); } private void addSwell(double duration = default_duration) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs index aadcc420df..e7dd9a18c2 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs @@ -1,7 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using JetBrains.Annotations; +using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets.Objects; using osuTK; @@ -15,49 +19,123 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables /// public class DrawableBarLine : DrawableHitObject { + public new BarLine HitObject => (BarLine)base.HitObject; + /// /// The width of the line tracker. /// private const float tracker_width = 2f; /// - /// Fade out time calibrated to a pre-empt of 1000ms. + /// The vertical offset of the triangles from the line tracker. /// - private const float base_fadeout_time = 100f; + private const float triangle_offset = 10f; + + /// + /// The size of the triangles. + /// + private const float triangle_size = 20f; /// /// The visual line tracker. /// - protected SkinnableDrawable Line; + private SkinnableDrawable line; /// - /// The bar line. + /// Container with triangles. Only visible for major lines. /// - protected readonly BarLine BarLine; + private Container triangleContainer; - public DrawableBarLine(BarLine barLine) + private readonly Bindable major = new Bindable(); + + public DrawableBarLine() + : this(null) + { + } + + public DrawableBarLine([CanBeNull] BarLine barLine) : base(barLine) { - BarLine = barLine; + } + [BackgroundDependencyLoader] + private void load() + { Anchor = Anchor.CentreLeft; Origin = Anchor.Centre; RelativeSizeAxes = Axes.Y; Width = tracker_width; - AddInternal(Line = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.BarLine), _ => new Box + AddRangeInternal(new Drawable[] { - RelativeSizeAxes = Axes.Both, - EdgeSmoothness = new Vector2(0.5f, 0), - }) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Alpha = 0.75f, + line = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.BarLine), _ => new Box + { + RelativeSizeAxes = Axes.Both, + EdgeSmoothness = new Vector2(0.5f, 0), + }) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + triangleContainer = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Children = new[] + { + new EquilateralTriangle + { + Name = "Top", + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Position = new Vector2(0, -triangle_offset), + Size = new Vector2(-triangle_size), + EdgeSmoothness = new Vector2(1), + }, + new EquilateralTriangle + { + Name = "Bottom", + Anchor = Anchor.BottomCentre, + Origin = Anchor.TopCentre, + Position = new Vector2(0, triangle_offset), + Size = new Vector2(triangle_size), + EdgeSmoothness = new Vector2(1), + } + } + } }); } - protected override void UpdateHitStateTransforms(ArmedState state) => this.FadeOut(150); + protected override void LoadComplete() + { + base.LoadComplete(); + major.BindValueChanged(majorChanged => updateMajor(majorChanged.NewValue), true); + } + + private void updateMajor(bool major) + { + line.Alpha = major ? 1f : 0.75f; + triangleContainer.Alpha = major ? 1 : 0; + } + + protected override void OnApply() + { + base.OnApply(); + major.BindTo(HitObject.MajorBindable); + } + + protected override void OnFree() + { + base.OnFree(); + major.UnbindFrom(HitObject.MajorBindable); + } + + protected override void UpdateHitStateTransforms(ArmedState state) + { + using (BeginAbsoluteSequence(HitObject.StartTime)) + this.FadeOutFromOne(150).Expire(); + } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLineMajor.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLineMajor.cs deleted file mode 100644 index 62aab3524b..0000000000 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLineMajor.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osuTK; -using osu.Framework.Graphics.Shapes; - -namespace osu.Game.Rulesets.Taiko.Objects.Drawables -{ - public class DrawableBarLineMajor : DrawableBarLine - { - /// - /// The vertical offset of the triangles from the line tracker. - /// - private const float triangle_offfset = 10f; - - /// - /// The size of the triangles. - /// - private const float triangle_size = 20f; - - private readonly Container triangleContainer; - - public DrawableBarLineMajor(BarLine barLine) - : base(barLine) - { - AddInternal(triangleContainer = new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Children = new[] - { - new EquilateralTriangle - { - Name = "Top", - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Position = new Vector2(0, -triangle_offfset), - Size = new Vector2(-triangle_size), - EdgeSmoothness = new Vector2(1), - }, - new EquilateralTriangle - { - Name = "Bottom", - Anchor = Anchor.BottomCentre, - Origin = Anchor.TopCentre, - Position = new Vector2(0, triangle_offfset), - Size = new Vector2(triangle_size), - EdgeSmoothness = new Vector2(1), - } - } - }); - - Line.Alpha = 1f; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - using (triangleContainer.BeginAbsoluteSequence(HitObject.StartTime)) - triangleContainer.FadeOut(150); - } - } -} diff --git a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs index e6aacf34dc..9ed5480777 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs @@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Taiko.UI [BackgroundDependencyLoader] private void load() { - new BarLineGenerator(Beatmap).BarLines.ForEach(bar => Playfield.Add(bar.Major ? new DrawableBarLineMajor(bar) : new DrawableBarLine(bar))); + new BarLineGenerator(Beatmap).BarLines.ForEach(bar => Playfield.Add(new DrawableBarLine(bar))); FrameStableComponents.Add(scroller = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.Scroller), _ => Empty()) { From 44dd9a57a8718da214ea801b35b9aca941518cc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 13 Dec 2020 20:03:24 +0100 Subject: [PATCH 12/35] Add abstract hit object application test scene --- .../HitObjectApplicationTestScene.cs | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 osu.Game.Rulesets.Taiko.Tests/HitObjectApplicationTestScene.cs diff --git a/osu.Game.Rulesets.Taiko.Tests/HitObjectApplicationTestScene.cs b/osu.Game.Rulesets.Taiko.Tests/HitObjectApplicationTestScene.cs new file mode 100644 index 0000000000..8e1b01385a --- /dev/null +++ b/osu.Game.Rulesets.Taiko.Tests/HitObjectApplicationTestScene.cs @@ -0,0 +1,53 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Testing; +using osu.Framework.Timing; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Taiko.Objects; +using osu.Game.Rulesets.UI.Scrolling; +using osu.Game.Tests.Visual; + +namespace osu.Game.Rulesets.Taiko.Tests +{ + public abstract class HitObjectApplicationTestScene : OsuTestScene + { + [Cached(typeof(IScrollingInfo))] + private ScrollingTestContainer.TestScrollingInfo info = new ScrollingTestContainer.TestScrollingInfo + { + Direction = { Value = ScrollingDirection.Left }, + TimeRange = { Value = 1000 }, + }; + + private ScrollingHitObjectContainer hitObjectContainer; + + [SetUpSteps] + public void SetUp() + => AddStep("create SHOC", () => Child = hitObjectContainer = new ScrollingHitObjectContainer + { + RelativeSizeAxes = Axes.X, + Height = 200, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Clock = new FramedClock(new StopwatchClock()) + }); + + protected void AddHitObject(Func hitObject) + => AddStep("add to SHOC", () => hitObjectContainer.Add(hitObject.Invoke())); + + protected void RemoveHitObject(Func hitObject) + => AddStep("remove from SHOC", () => hitObjectContainer.Remove(hitObject.Invoke())); + + protected TObject PrepareObject(TObject hitObject) + where TObject : TaikoHitObject + { + hitObject.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + return hitObject; + } + } +} From c103c3691f53364298b517691739a19200ba915f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 13 Dec 2020 20:09:44 +0100 Subject: [PATCH 13/35] Add test for bar line application --- .../TestBarLineApplication.cs | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 osu.Game.Rulesets.Taiko.Tests/TestBarLineApplication.cs diff --git a/osu.Game.Rulesets.Taiko.Tests/TestBarLineApplication.cs b/osu.Game.Rulesets.Taiko.Tests/TestBarLineApplication.cs new file mode 100644 index 0000000000..3e5a956d64 --- /dev/null +++ b/osu.Game.Rulesets.Taiko.Tests/TestBarLineApplication.cs @@ -0,0 +1,34 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Game.Rulesets.Taiko.Objects; +using osu.Game.Rulesets.Taiko.Objects.Drawables; + +namespace osu.Game.Rulesets.Taiko.Tests +{ + public class TestBarLineApplication : HitObjectApplicationTestScene + { + [Test] + public void TestApplyNewBarLine() + { + DrawableBarLine barLine = null; + + AddHitObject(() => barLine = new DrawableBarLine(PrepareObject(new BarLine + { + StartTime = 400, + Major = true + }))); + + RemoveHitObject(() => barLine); + + AddStep("apply new bar line", () => barLine.Apply(PrepareObject(new BarLine + { + StartTime = 200, + Major = false + }), null)); + + AddHitObject(() => barLine); + } + } +} From ea09cbddc6944a612e81b29a1236b02081c3d1c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 13 Dec 2020 20:12:54 +0100 Subject: [PATCH 14/35] Register bar line pool & use in drawable ruleset --- osu.Game.Rulesets.Taiko.Tests/TestSceneHits.cs | 2 +- osu.Game.Rulesets.Taiko/UI/BarLinePlayfield.cs | 8 ++++++++ osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneHits.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneHits.cs index 18ee903977..7695ca067b 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneHits.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneHits.cs @@ -151,7 +151,7 @@ namespace osu.Game.Rulesets.Taiko.Tests Major = major }; - DrawableRuleset.Playfield.Add(new DrawableBarLine(bl)); + DrawableRuleset.Playfield.Add(bl); } private void addSwell(double duration = default_duration) diff --git a/osu.Game.Rulesets.Taiko/UI/BarLinePlayfield.cs b/osu.Game.Rulesets.Taiko/UI/BarLinePlayfield.cs index 83d0a17e09..cb878e8ea0 100644 --- a/osu.Game.Rulesets.Taiko/UI/BarLinePlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/BarLinePlayfield.cs @@ -1,11 +1,19 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Allocation; +using osu.Game.Rulesets.Taiko.Objects; +using osu.Game.Rulesets.Taiko.Objects.Drawables; using osu.Game.Rulesets.UI.Scrolling; namespace osu.Game.Rulesets.Taiko.UI { public class BarLinePlayfield : ScrollingPlayfield { + [BackgroundDependencyLoader] + private void load() + { + RegisterPool(15); + } } } diff --git a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs index 9ed5480777..bbf8cb8de0 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs @@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Taiko.UI [BackgroundDependencyLoader] private void load() { - new BarLineGenerator(Beatmap).BarLines.ForEach(bar => Playfield.Add(new DrawableBarLine(bar))); + new BarLineGenerator(Beatmap).BarLines.ForEach(bar => Playfield.Add(bar)); FrameStableComponents.Add(scroller = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.Scroller), _ => Empty()) { From d275418b2598c14f5a217cf96ec45887ad4b7409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Sun, 13 Dec 2020 23:17:26 +0100 Subject: [PATCH 15/35] Rename and simplify test --- .../HitObjectApplicationTestScene.cs | 9 ++++----- ...plication.cs => TestSceneBarLineApplication.cs} | 14 ++++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) rename osu.Game.Rulesets.Taiko.Tests/{TestBarLineApplication.cs => TestSceneBarLineApplication.cs} (68%) diff --git a/osu.Game.Rulesets.Taiko.Tests/HitObjectApplicationTestScene.cs b/osu.Game.Rulesets.Taiko.Tests/HitObjectApplicationTestScene.cs index 8e1b01385a..07c7b4d1db 100644 --- a/osu.Game.Rulesets.Taiko.Tests/HitObjectApplicationTestScene.cs +++ b/osu.Game.Rulesets.Taiko.Tests/HitObjectApplicationTestScene.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Testing; @@ -37,11 +36,11 @@ namespace osu.Game.Rulesets.Taiko.Tests Clock = new FramedClock(new StopwatchClock()) }); - protected void AddHitObject(Func hitObject) - => AddStep("add to SHOC", () => hitObjectContainer.Add(hitObject.Invoke())); + protected void AddHitObject(DrawableHitObject hitObject) + => AddStep("add to SHOC", () => hitObjectContainer.Add(hitObject)); - protected void RemoveHitObject(Func hitObject) - => AddStep("remove from SHOC", () => hitObjectContainer.Remove(hitObject.Invoke())); + protected void RemoveHitObject(DrawableHitObject hitObject) + => AddStep("remove from SHOC", () => hitObjectContainer.Remove(hitObject)); protected TObject PrepareObject(TObject hitObject) where TObject : TaikoHitObject diff --git a/osu.Game.Rulesets.Taiko.Tests/TestBarLineApplication.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneBarLineApplication.cs similarity index 68% rename from osu.Game.Rulesets.Taiko.Tests/TestBarLineApplication.cs rename to osu.Game.Rulesets.Taiko.Tests/TestSceneBarLineApplication.cs index 3e5a956d64..65230a07bc 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestBarLineApplication.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneBarLineApplication.cs @@ -7,28 +7,26 @@ using osu.Game.Rulesets.Taiko.Objects.Drawables; namespace osu.Game.Rulesets.Taiko.Tests { - public class TestBarLineApplication : HitObjectApplicationTestScene + public class TestSceneBarLineApplication : HitObjectApplicationTestScene { [Test] public void TestApplyNewBarLine() { - DrawableBarLine barLine = null; - - AddHitObject(() => barLine = new DrawableBarLine(PrepareObject(new BarLine + DrawableBarLine barLine = new DrawableBarLine(PrepareObject(new BarLine { StartTime = 400, Major = true - }))); + })); - RemoveHitObject(() => barLine); + AddHitObject(barLine); + RemoveHitObject(barLine); AddStep("apply new bar line", () => barLine.Apply(PrepareObject(new BarLine { StartTime = 200, Major = false }), null)); - - AddHitObject(() => barLine); + AddHitObject(barLine); } } } From 6b78045ff1b35b0d406d43494feda064d97a43ed Mon Sep 17 00:00:00 2001 From: Firmatorenio Date: Mon, 14 Dec 2020 06:57:43 +0600 Subject: [PATCH 16/35] fix codefactor empty line complaint --- osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index 7259bf293c..2f817a6c30 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -32,7 +32,6 @@ namespace osu.Game.Rulesets.UI.Scrolling protected virtual void OnSkinChanged() { - } /// From 8da502da4405ad5658a702f67e8ad3eb71e24453 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Wed, 9 Dec 2020 17:46:36 +0900 Subject: [PATCH 17/35] Separate asymmetric CatchHitObject.X to EffectiveX and OriginalX --- .../Objects/CatchHitObject.cs | 25 +++++++++++-------- .../Drawables/DrawableCatchHitObject.cs | 4 +-- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index b86b3a7496..9fdd590464 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -16,23 +16,27 @@ namespace osu.Game.Rulesets.Catch.Objects { public const float OBJECT_RADIUS = 64; - // This value is after XOffset applied. - public readonly Bindable XBindable = new Bindable(); + public readonly Bindable OriginalXBindable = new Bindable(); - // This value is before XOffset applied. - private float originalX; + public float OriginalX + { + get => OriginalXBindable.Value; + set => OriginalXBindable.Value = value; + } /// /// The horizontal position of the fruit between 0 and . /// public float X { - // TODO: I don't like this asymmetry. - get => XBindable.Value; - // originalX is set by `XBindable.BindValueChanged` - set => XBindable.Value = value + xOffset; + get => EffectiveX; + set => OriginalXBindable.Value = value; } + public readonly Bindable EffectiveXBindable = new Bindable(); + + public float EffectiveX => EffectiveXBindable.Value; + private float xOffset; /// @@ -40,11 +44,10 @@ namespace osu.Game.Rulesets.Catch.Objects /// internal float XOffset { - get => xOffset; set { xOffset = value; - XBindable.Value = originalX + xOffset; + EffectiveXBindable.Value = OriginalX + xOffset; } } @@ -116,7 +119,7 @@ namespace osu.Game.Rulesets.Catch.Objects protected CatchHitObject() { - XBindable.BindValueChanged(x => originalX = x.NewValue - xOffset); + OriginalXBindable.BindValueChanged(change => EffectiveXBindable.Value = change.NewValue + xOffset); } } } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs index bfd124c691..131edb650f 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs @@ -38,14 +38,14 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables { base.OnApply(); - XBindable.BindTo(HitObject.XBindable); + XBindable.BindTo(HitObject.EffectiveXBindable); } protected override void OnFree() { base.OnFree(); - XBindable.UnbindFrom(HitObject.XBindable); + XBindable.UnbindFrom(HitObject.EffectiveXBindable); } public Func CheckPosition; From c1f3f1c231c259ff4b494ce3bdcb3d11d3632469 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Wed, 9 Dec 2020 17:47:17 +0900 Subject: [PATCH 18/35] Obsolete `X` getter --- osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index 9fdd590464..a5c254f2f1 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Bindables; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; @@ -29,6 +30,7 @@ namespace osu.Game.Rulesets.Catch.Objects /// public float X { + [Obsolete("Use EffectiveX instead")] get => EffectiveX; set => OriginalXBindable.Value = value; } From 96f3e0dad8243d221592d99ed39949488d829e6f Mon Sep 17 00:00:00 2001 From: ekrctb Date: Wed, 9 Dec 2020 17:58:53 +0900 Subject: [PATCH 19/35] Replace CatchHitObject.X usage to EffectiveX and OriginalX --- .../CatchBeatmapConversionTest.cs | 2 +- .../TestSceneCatcherArea.cs | 2 +- .../Beatmaps/CatchBeatmapProcessor.cs | 14 +++++++------- .../Preprocessing/CatchDifficultyHitObject.cs | 4 ++-- .../Objects/Drawables/DrawableCatchHitObject.cs | 2 +- osu.Game.Rulesets.Catch/Objects/JuiceStream.cs | 8 ++++---- .../Replays/CatchAutoGenerator.cs | 16 ++++++++-------- osu.Game.Rulesets.Catch/UI/Catcher.cs | 6 +++--- 8 files changed, 27 insertions(+), 27 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs index 466cbdaf8d..33fdcdaf1e 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs @@ -84,7 +84,7 @@ namespace osu.Game.Rulesets.Catch.Tests public float Position { - get => HitObject?.X ?? position; + get => HitObject?.EffectiveX ?? position; set => position = value; } diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs index 31c285ef22..5079e57e5e 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs @@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Catch.Tests private void attemptCatch(Fruit fruit) { - fruit.X += catcher.X; + fruit.OriginalX += catcher.X; fruit.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = circleSize diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs index 00ce9ea8c2..fac5d03833 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs @@ -75,7 +75,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps case JuiceStream juiceStream: // Todo: BUG!! Stable used the last control point as the final position of the path, but it should use the computed path instead. - lastPosition = juiceStream.X + juiceStream.Path.ControlPoints[^1].Position.Value.X; + lastPosition = juiceStream.OriginalX + juiceStream.Path.ControlPoints[^1].Position.Value.X; // Todo: BUG!! Stable attempted to use the end time of the stream, but referenced it too early in execution and used the start time instead. lastStartTime = juiceStream.StartTime; @@ -86,7 +86,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps catchObject.XOffset = 0; if (catchObject is TinyDroplet) - catchObject.XOffset = Math.Clamp(rng.Next(-20, 20), -catchObject.X, CatchPlayfield.WIDTH - catchObject.X); + catchObject.XOffset = Math.Clamp(rng.Next(-20, 20), -catchObject.OriginalX, CatchPlayfield.WIDTH - catchObject.OriginalX); else if (catchObject is Droplet) rng.Next(); // osu!stable retrieved a random droplet rotation } @@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps private static void applyHardRockOffset(CatchHitObject hitObject, ref float? lastPosition, ref double lastStartTime, FastRandom rng) { - float offsetPosition = hitObject.X; + float offsetPosition = hitObject.OriginalX; double startTime = hitObject.StartTime; if (lastPosition == null) @@ -126,7 +126,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps if (positionDiff == 0) { applyRandomOffset(ref offsetPosition, timeDiff / 4d, rng); - hitObject.XOffset = offsetPosition - hitObject.X; + hitObject.XOffset = offsetPosition - hitObject.OriginalX; return; } @@ -134,7 +134,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps if (Math.Abs(positionDiff) < timeDiff / 3) applyOffset(ref offsetPosition, positionDiff); - hitObject.XOffset = offsetPosition - hitObject.X; + hitObject.XOffset = offsetPosition - hitObject.OriginalX; lastPosition = offsetPosition; lastStartTime = startTime; @@ -230,9 +230,9 @@ namespace osu.Game.Rulesets.Catch.Beatmaps currentObject.HyperDashTarget = null; currentObject.DistanceToHyperDash = 0; - int thisDirection = nextObject.X > currentObject.X ? 1 : -1; + int thisDirection = nextObject.EffectiveX > currentObject.EffectiveX ? 1 : -1; double timeToNext = nextObject.StartTime - currentObject.StartTime - 1000f / 60f / 4; // 1/4th of a frame of grace time, taken from osu-stable - double distanceToNext = Math.Abs(nextObject.X - currentObject.X) - (lastDirection == thisDirection ? lastExcess : halfCatcherWidth); + double distanceToNext = Math.Abs(nextObject.EffectiveX - currentObject.EffectiveX) - (lastDirection == thisDirection ? lastExcess : halfCatcherWidth); float distanceToHyper = (float)(timeToNext * Catcher.BASE_SPEED - distanceToNext); if (distanceToHyper < 0) diff --git a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs index dcd410e08f..d936ef97ac 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs @@ -32,8 +32,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing // We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps. var scalingFactor = normalized_hitobject_radius / halfCatcherWidth; - NormalizedPosition = BaseObject.X * scalingFactor; - LastNormalizedPosition = LastObject.X * scalingFactor; + NormalizedPosition = BaseObject.EffectiveX * scalingFactor; + LastNormalizedPosition = LastObject.EffectiveX * scalingFactor; // Every strain interval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure StrainTime = Math.Max(40, DeltaTime); diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs index 131edb650f..c511ea5006 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables protected override double InitialLifetimeOffset => HitObject.TimePreempt; - protected override float SamplePlaybackPosition => HitObject.X / CatchPlayfield.WIDTH; + protected override float SamplePlaybackPosition => HitObject.EffectiveX / CatchPlayfield.WIDTH; public int RandomSeed => HitObject?.RandomSeed ?? 0; diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs index d5819935ad..35fd58826e 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs @@ -75,7 +75,7 @@ namespace osu.Game.Rulesets.Catch.Objects AddNested(new TinyDroplet { StartTime = t + lastEvent.Value.Time, - X = X + Path.PositionAt( + X = OriginalX + Path.PositionAt( lastEvent.Value.PathProgress + (t / sinceLastTick) * (e.PathProgress - lastEvent.Value.PathProgress)).X, }); } @@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.Catch.Objects { Samples = dropletSamples, StartTime = e.Time, - X = X + Path.PositionAt(e.PathProgress).X, + X = OriginalX + Path.PositionAt(e.PathProgress).X, }); break; @@ -104,14 +104,14 @@ namespace osu.Game.Rulesets.Catch.Objects { Samples = this.GetNodeSamples(nodeIndex++), StartTime = e.Time, - X = X + Path.PositionAt(e.PathProgress).X, + X = OriginalX + Path.PositionAt(e.PathProgress).X, }); break; } } } - public float EndX => X + this.CurvePositionAt(1).X; + public float EndX => OriginalX + this.CurvePositionAt(1).X; public double Duration { diff --git a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs index dfc81ee8d9..32e8ab5da7 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Catch.Replays void moveToNext(PalpableCatchHitObject h) { - float positionChange = Math.Abs(lastPosition - h.X); + float positionChange = Math.Abs(lastPosition - h.EffectiveX); double timeAvailable = h.StartTime - lastTime; // So we can either make it there without a dash or not. @@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Catch.Replays // todo: get correct catcher size, based on difficulty CS. const float catcher_width_half = CatcherArea.CATCHER_SIZE * 0.3f * 0.5f; - if (lastPosition - catcher_width_half < h.X && lastPosition + catcher_width_half > h.X) + if (lastPosition - catcher_width_half < h.EffectiveX && lastPosition + catcher_width_half > h.EffectiveX) { // we are already in the correct range. lastTime = h.StartTime; @@ -66,12 +66,12 @@ namespace osu.Game.Rulesets.Catch.Replays if (impossibleJump) { - addFrame(h.StartTime, h.X); + addFrame(h.StartTime, h.EffectiveX); } else if (h.HyperDash) { addFrame(h.StartTime - timeAvailable, lastPosition); - addFrame(h.StartTime, h.X); + addFrame(h.StartTime, h.EffectiveX); } else if (dashRequired) { @@ -80,23 +80,23 @@ namespace osu.Game.Rulesets.Catch.Replays double timeWeNeedToSave = timeAtNormalSpeed - timeAvailable; double timeAtDashSpeed = timeWeNeedToSave / 2; - float midPosition = (float)Interpolation.Lerp(lastPosition, h.X, (float)timeAtDashSpeed / timeAvailable); + float midPosition = (float)Interpolation.Lerp(lastPosition, h.EffectiveX, (float)timeAtDashSpeed / timeAvailable); // dash movement addFrame(h.StartTime - timeAvailable + 1, lastPosition, true); addFrame(h.StartTime - timeAvailable + timeAtDashSpeed, midPosition); - addFrame(h.StartTime, h.X); + addFrame(h.StartTime, h.EffectiveX); } else { double timeBefore = positionChange / movement_speed; addFrame(h.StartTime - timeBefore, lastPosition); - addFrame(h.StartTime, h.X); + addFrame(h.StartTime, h.EffectiveX); } lastTime = h.StartTime; - lastPosition = h.X; + lastPosition = h.EffectiveX; } foreach (var obj in Beatmap.HitObjects) diff --git a/osu.Game.Rulesets.Catch/UI/Catcher.cs b/osu.Game.Rulesets.Catch/UI/Catcher.cs index f164c2655a..ed875e7002 100644 --- a/osu.Game.Rulesets.Catch/UI/Catcher.cs +++ b/osu.Game.Rulesets.Catch/UI/Catcher.cs @@ -216,7 +216,7 @@ namespace osu.Game.Rulesets.Catch.UI var halfCatchWidth = catchWidth * 0.5f; // this stuff wil disappear once we move fruit to non-relative coordinate space in the future. - var catchObjectPosition = fruit.X; + var catchObjectPosition = fruit.EffectiveX; var catcherPosition = Position.X; return catchObjectPosition >= catcherPosition - halfCatchWidth && @@ -250,10 +250,10 @@ namespace osu.Game.Rulesets.Catch.UI { var target = hitObject.HyperDashTarget; var timeDifference = target.StartTime - hitObject.StartTime; - double positionDifference = target.X - X; + double positionDifference = target.EffectiveX - X; var velocity = positionDifference / Math.Max(1.0, timeDifference - 1000.0 / 60.0); - SetHyperDashState(Math.Abs(velocity), target.X); + SetHyperDashState(Math.Abs(velocity), target.EffectiveX); } else SetHyperDashState(); From cd2db59900f8d8b7f79dea26bb9a035fb334f503 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 14 Dec 2020 11:05:26 +0900 Subject: [PATCH 20/35] XBindable -> EffectiveXBindable in catch DHO --- .../Objects/Drawables/DrawableCatchHitObject.cs | 6 +++--- .../Objects/Drawables/DrawablePalpableCatchHitObject.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs index c511ea5006..edd607a443 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables { public abstract class DrawableCatchHitObject : DrawableHitObject { - public readonly Bindable XBindable = new Bindable(); + public readonly Bindable EffectiveXBindable = new Bindable(); protected override double InitialLifetimeOffset => HitObject.TimePreempt; @@ -38,14 +38,14 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables { base.OnApply(); - XBindable.BindTo(HitObject.EffectiveXBindable); + EffectiveXBindable.BindTo(HitObject.EffectiveXBindable); } protected override void OnFree() { base.OnFree(); - XBindable.UnbindFrom(HitObject.EffectiveXBindable); + EffectiveXBindable.UnbindFrom(HitObject.EffectiveXBindable); } public Func CheckPosition; diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawablePalpableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawablePalpableCatchHitObject.cs index 7df06bd92d..d3fa43c6b6 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawablePalpableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawablePalpableCatchHitObject.cs @@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables [BackgroundDependencyLoader] private void load() { - XBindable.BindValueChanged(x => + EffectiveXBindable.BindValueChanged(x => { X = x.NewValue; }, true); From 089f3bebf57f3be57c8a1b2e525681a62f8d095a Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 14 Dec 2020 11:15:49 +0900 Subject: [PATCH 21/35] Add doc comments to catch hit object X properties --- osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index a5c254f2f1..d40821c840 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -19,6 +19,12 @@ namespace osu.Game.Rulesets.Catch.Objects public readonly Bindable OriginalXBindable = new Bindable(); + /// + /// The horizontal position of the hit object between 0 and . + /// + /// + /// This value is the original value specified in the beatmap, not affected by beatmap processing. + /// public float OriginalX { get => OriginalXBindable.Value; @@ -37,12 +43,15 @@ namespace osu.Game.Rulesets.Catch.Objects public readonly Bindable EffectiveXBindable = new Bindable(); + /// + /// The effective horizontal position of the hit object between 0 and . + /// public float EffectiveX => EffectiveXBindable.Value; private float xOffset; /// - /// A random offset applied to , set by the . + /// A random offset applied to the horizontal value, set by the . /// internal float XOffset { From 36529bdd1b103ea5c5284b70e1cfbf30eec19f2b Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 14 Dec 2020 11:25:09 +0900 Subject: [PATCH 22/35] Use OriginalX for CatchHitObject.X instead of EffectiveX And explicitly implement IHasXPosition interface to prevent use of the X property. It should be preferred for beatmap conversion purpose. --- osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index d40821c840..6a040efb91 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Framework.Bindables; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; @@ -31,14 +30,11 @@ namespace osu.Game.Rulesets.Catch.Objects set => OriginalXBindable.Value = value; } - /// - /// The horizontal position of the fruit between 0 and . - /// + float IHasXPosition.X => OriginalX; + public float X { - [Obsolete("Use EffectiveX instead")] - get => EffectiveX; - set => OriginalXBindable.Value = value; + set => OriginalX = value; } public readonly Bindable EffectiveXBindable = new Bindable(); From f621d977fc413835f411e1dc8cc57d61505ca71e Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 14 Dec 2020 11:32:34 +0900 Subject: [PATCH 23/35] Add some more doc comment --- osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index 6a040efb91..e689d6a178 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -23,6 +23,7 @@ namespace osu.Game.Rulesets.Catch.Objects /// /// /// This value is the original value specified in the beatmap, not affected by beatmap processing. + /// It should be used instead of when working on a beatmap, not a gameplay. /// public float OriginalX { @@ -32,6 +33,9 @@ namespace osu.Game.Rulesets.Catch.Objects float IHasXPosition.X => OriginalX; + /// + /// An alias of setter. + /// public float X { set => OriginalX = value; From 7cbbd74df247626ae917f766bcc6f03cd5e37a27 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 14 Dec 2020 11:38:07 +0900 Subject: [PATCH 24/35] Remove X setter from CatchHitObject --- .../Mods/TestSceneCatchModRelax.cs | 8 +++---- .../TestSceneAutoJuiceStream.cs | 2 +- .../TestSceneCatchModHidden.cs | 2 +- .../TestSceneCatchStacker.cs | 2 +- .../TestSceneCatcher.cs | 22 +++++++++---------- .../TestSceneCatcherArea.cs | 2 +- .../TestSceneDrawableHitObjects.cs | 6 ++--- .../TestSceneHyperDash.cs | 14 ++++++------ .../TestSceneJuiceStream.cs | 4 ++-- .../Beatmaps/CatchBeatmapConverter.cs | 4 ++-- .../Objects/CatchHitObject.cs | 8 ------- .../Objects/JuiceStream.cs | 6 ++--- 12 files changed, 36 insertions(+), 44 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs b/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs index c01aff0aa0..da4834aa73 100644 --- a/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs +++ b/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs @@ -32,22 +32,22 @@ namespace osu.Game.Rulesets.Catch.Tests.Mods { new Fruit { - X = CatchPlayfield.CENTER_X, + OriginalX = CatchPlayfield.CENTER_X, StartTime = 0 }, new Fruit { - X = 0, + OriginalX = 0, StartTime = 1000 }, new Fruit { - X = CatchPlayfield.WIDTH, + OriginalX = CatchPlayfield.WIDTH, StartTime = 2000 }, new JuiceStream { - X = CatchPlayfield.CENTER_X, + OriginalX = CatchPlayfield.CENTER_X, StartTime = 3000, Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, Vector2.UnitY * 200 }) } diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs index f552c3c27b..45cf5095f6 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Catch.Tests beatmap.HitObjects.Add(new JuiceStream { - X = CatchPlayfield.CENTER_X - width / 2, + OriginalX = CatchPlayfield.CENTER_X - width / 2, Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs index f15da29993..6af9c88088 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs @@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Catch.Tests { StartTime = 1000, Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, new Vector2(0, -192) }), - X = CatchPlayfield.WIDTH / 2 + OriginalX = CatchPlayfield.WIDTH / 2 } } }, diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs index 1ff31697b8..d7835bd8c4 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs @@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Catch.Tests { beatmap.HitObjects.Add(new Fruit { - X = (0.5f + i / 2048f * (i % 10 - 5)) * CatchPlayfield.WIDTH, + OriginalX = (0.5f + i / 2048f * (i % 10 - 5)) * CatchPlayfield.WIDTH, StartTime = i * 100, NewCombo = i % 8 == 0 }); diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs index e8bb57cdf3..d57e8e027e 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs @@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Catch.Tests JudgementResult result2 = null; AddStep("catch hyper fruit", () => { - attemptCatch(new Fruit { HyperDashTarget = new Fruit { X = 100 } }, out drawableObject1, out result1); + attemptCatch(new Fruit { HyperDashTarget = new Fruit { OriginalX = 100 } }, out drawableObject1, out result1); }); AddStep("catch normal fruit", () => { @@ -107,14 +107,14 @@ namespace osu.Game.Rulesets.Catch.Tests var halfWidth = Catcher.CalculateCatchWidth(new BeatmapDifficulty { CircleSize = 0 }) / 2; AddStep("catch fruit", () => { - attemptCatch(new Fruit { X = -halfWidth + 1 }); - attemptCatch(new Fruit { X = halfWidth - 1 }); + attemptCatch(new Fruit { OriginalX = -halfWidth + 1 }); + attemptCatch(new Fruit { OriginalX = halfWidth - 1 }); }); checkPlate(2); AddStep("miss fruit", () => { - attemptCatch(new Fruit { X = -halfWidth - 1 }); - attemptCatch(new Fruit { X = halfWidth + 1 }); + attemptCatch(new Fruit { OriginalX = -halfWidth - 1 }); + attemptCatch(new Fruit { OriginalX = halfWidth + 1 }); }); checkPlate(2); } @@ -122,7 +122,7 @@ namespace osu.Game.Rulesets.Catch.Tests [Test] public void TestFruitChangesCatcherState() { - AddStep("miss fruit", () => attemptCatch(new Fruit { X = 100 })); + AddStep("miss fruit", () => attemptCatch(new Fruit { OriginalX = 100 })); checkState(CatcherAnimationState.Fail); AddStep("catch fruit", () => attemptCatch(new Fruit())); checkState(CatcherAnimationState.Idle); @@ -135,7 +135,7 @@ namespace osu.Game.Rulesets.Catch.Tests { AddStep("catch hyper fruit", () => attemptCatch(new Fruit { - HyperDashTarget = new Fruit { X = 100 } + HyperDashTarget = new Fruit { OriginalX = 100 } })); checkHyperDash(true); AddStep("catch normal fruit", () => attemptCatch(new Fruit())); @@ -147,10 +147,10 @@ namespace osu.Game.Rulesets.Catch.Tests { AddStep("catch hyper kiai fruit", () => attemptCatch(new TestKiaiFruit { - HyperDashTarget = new Fruit { X = 100 } + HyperDashTarget = new Fruit { OriginalX = 100 } })); AddStep("catch tiny droplet", () => attemptCatch(new TinyDroplet())); - AddStep("miss tiny droplet", () => attemptCatch(new TinyDroplet { X = 100 })); + AddStep("miss tiny droplet", () => attemptCatch(new TinyDroplet { OriginalX = 100 })); // catcher state and hyper dash state is preserved checkState(CatcherAnimationState.Kiai); checkHyperDash(true); @@ -161,9 +161,9 @@ namespace osu.Game.Rulesets.Catch.Tests { AddStep("catch hyper kiai fruit", () => attemptCatch(new TestKiaiFruit { - HyperDashTarget = new Fruit { X = 100 } + HyperDashTarget = new Fruit { OriginalX = 100 } })); - AddStep("miss banana", () => attemptCatch(new Banana { X = 100 })); + AddStep("miss banana", () => attemptCatch(new Banana { OriginalX = 100 })); // catcher state is preserved but hyper dash state is reset checkState(CatcherAnimationState.Kiai); checkHyperDash(false); diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs index 5079e57e5e..423c3b7a13 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Catch.Tests AddStep("catch fruit", () => attemptCatch(new Fruit())); AddStep("catch fruit last in combo", () => attemptCatch(new Fruit { LastInCombo = true })); AddStep("catch kiai fruit", () => attemptCatch(new TestSceneCatcher.TestKiaiFruit())); - AddStep("miss last in combo", () => attemptCatch(new Fruit { X = 100, LastInCombo = true })); + AddStep("miss last in combo", () => attemptCatch(new Fruit { OriginalX = 100, LastInCombo = true })); } private void attemptCatch(Fruit fruit) diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs index 3e4995482d..2db534e8c9 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs @@ -105,7 +105,7 @@ namespace osu.Game.Rulesets.Catch.Tests { var fruit = new Fruit { - X = getXCoords(hit), + OriginalX = getXCoords(hit), LastInCombo = i % 4 == 0, StartTime = playfieldTime + 800 + (200 * i) }; @@ -122,7 +122,7 @@ namespace osu.Game.Rulesets.Catch.Tests var juice = new JuiceStream { - X = xCoords, + OriginalX = xCoords, StartTime = playfieldTime + 1000, Path = new SliderPath(PathType.Linear, new[] { @@ -145,7 +145,7 @@ namespace osu.Game.Rulesets.Catch.Tests { var banana = new Banana { - X = getXCoords(hit), + OriginalX = getXCoords(hit), LastInCombo = i % 4 == 0, StartTime = playfieldTime + 800 + (200 * i) }; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs index db09b2bc6b..67af3c4420 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs @@ -70,20 +70,20 @@ namespace osu.Game.Rulesets.Catch.Tests beatmap.ControlPointInfo.Add(0, new TimingControlPoint()); // Should produce a hyper-dash (edge case test) - beatmap.HitObjects.Add(new Fruit { StartTime = 1816, X = 56, NewCombo = true }); - beatmap.HitObjects.Add(new Fruit { StartTime = 2008, X = 308, NewCombo = true }); + beatmap.HitObjects.Add(new Fruit { StartTime = 1816, OriginalX = 56, NewCombo = true }); + beatmap.HitObjects.Add(new Fruit { StartTime = 2008, OriginalX = 308, NewCombo = true }); double startTime = 3000; const float left_x = 0.02f * CatchPlayfield.WIDTH; const float right_x = 0.98f * CatchPlayfield.WIDTH; - createObjects(() => new Fruit { X = left_x }); + createObjects(() => new Fruit { OriginalX = left_x }); createObjects(() => new TestJuiceStream(right_x), 1); createObjects(() => new TestJuiceStream(left_x), 1); - createObjects(() => new Fruit { X = right_x }); - createObjects(() => new Fruit { X = left_x }); - createObjects(() => new Fruit { X = right_x }); + createObjects(() => new Fruit { OriginalX = right_x }); + createObjects(() => new Fruit { OriginalX = left_x }); + createObjects(() => new Fruit { OriginalX = right_x }); createObjects(() => new TestJuiceStream(left_x), 1); beatmap.ControlPointInfo.Add(startTime, new TimingControlPoint @@ -121,7 +121,7 @@ namespace osu.Game.Rulesets.Catch.Tests { public TestJuiceStream(float x) { - X = x; + OriginalX = x; Path = new SliderPath(new[] { diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs index 269e783899..dbcf382d62 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Catch.Tests { new JuiceStream { - X = CatchPlayfield.CENTER_X, + OriginalX = CatchPlayfield.CENTER_X, Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Catch.Tests }, new Banana { - X = CatchPlayfield.CENTER_X, + OriginalX = CatchPlayfield.CENTER_X, StartTime = 1000, NewCombo = true } diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index 34964fc4ae..55e86a7be2 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps Path = curveData.Path, NodeSamples = curveData.NodeSamples, RepeatCount = curveData.RepeatCount, - X = positionData?.X ?? 0, + OriginalX = positionData?.X ?? 0, NewCombo = comboData?.NewCombo ?? false, ComboOffset = comboData?.ComboOffset ?? 0, LegacyLastTickOffset = (obj as IHasLegacyLastTickOffset)?.LegacyLastTickOffset ?? 0 @@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps Samples = obj.Samples, NewCombo = comboData?.NewCombo ?? false, ComboOffset = comboData?.ComboOffset ?? 0, - X = positionData?.X ?? 0 + OriginalX = positionData?.X ?? 0 }.Yield(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index e689d6a178..ebbbd44960 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -33,14 +33,6 @@ namespace osu.Game.Rulesets.Catch.Objects float IHasXPosition.X => OriginalX; - /// - /// An alias of setter. - /// - public float X - { - set => OriginalX = value; - } - public readonly Bindable EffectiveXBindable = new Bindable(); /// diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs index 35fd58826e..bda0457c83 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs @@ -75,7 +75,7 @@ namespace osu.Game.Rulesets.Catch.Objects AddNested(new TinyDroplet { StartTime = t + lastEvent.Value.Time, - X = OriginalX + Path.PositionAt( + OriginalX = OriginalX + Path.PositionAt( lastEvent.Value.PathProgress + (t / sinceLastTick) * (e.PathProgress - lastEvent.Value.PathProgress)).X, }); } @@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.Catch.Objects { Samples = dropletSamples, StartTime = e.Time, - X = OriginalX + Path.PositionAt(e.PathProgress).X, + OriginalX = OriginalX + Path.PositionAt(e.PathProgress).X, }); break; @@ -104,7 +104,7 @@ namespace osu.Game.Rulesets.Catch.Objects { Samples = this.GetNodeSamples(nodeIndex++), StartTime = e.Time, - X = OriginalX + Path.PositionAt(e.PathProgress).X, + OriginalX = OriginalX + Path.PositionAt(e.PathProgress).X, }); break; } From 1794bfeddba4b8533d10f9854f06a0f5e9731cc7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 14 Dec 2020 13:07:55 +0900 Subject: [PATCH 25/35] Move offset into legacy mania judgement --- .../Legacy/LegacyManiaJudgementPiece.cs | 84 +++++++++++++++++++ .../Legacy/ManiaLegacySkinTransformer.cs | 3 +- .../UI/DrawableManiaJudgement.cs | 53 +++++------- osu.Game.Rulesets.Mania/UI/Stage.cs | 8 +- .../UI/Scrolling/ScrollingPlayfield.cs | 9 -- 5 files changed, 108 insertions(+), 49 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaJudgementPiece.cs diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaJudgementPiece.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaJudgementPiece.cs new file mode 100644 index 0000000000..464d754205 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaJudgementPiece.cs @@ -0,0 +1,84 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Animations; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Mania.UI; +using osu.Game.Rulesets.Scoring; +using osu.Game.Skinning; +using osuTK; + +namespace osu.Game.Rulesets.Mania.Skinning.Legacy +{ + public class LegacyManiaJudgementPiece : CompositeDrawable, IAnimatableJudgement + { + private readonly HitResult result; + private readonly Drawable animation; + + public LegacyManiaJudgementPiece(HitResult result, Drawable animation) + { + this.result = result; + this.animation = animation; + + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + AutoSizeAxes = Axes.Both; + } + + [BackgroundDependencyLoader] + private void load(ISkinSource skin) + { + float? scorePosition = skin.GetManiaSkinConfig(LegacyManiaSkinConfigurationLookups.ScorePosition)?.Value; + + if (scorePosition != null) + scorePosition -= Stage.HIT_TARGET_POSITION + 150; + + Y = scorePosition ?? 0; + + if (animation != null) + InternalChild = animation; + } + + public void PlayAnimation() + { + if (animation == null) + return; + + (animation as IFramedAnimation)?.GotoFrame(0); + + switch (result) + { + case HitResult.None: + break; + + case HitResult.Miss: + animation.ScaleTo(1.6f); + animation.ScaleTo(1, 100, Easing.In); + + animation.MoveTo(Vector2.Zero); + animation.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint); + + animation.RotateTo(0); + animation.RotateTo(40, 800, Easing.InQuint); + + this.FadeOutFromOne(800); + break; + + default: + animation.ScaleTo(0.8f); + animation.ScaleTo(1, 250, Easing.OutElastic); + + animation.Delay(50).ScaleTo(0.75f, 250); + + this.Delay(50).FadeOut(200); + break; + } + } + + public Drawable GetAboveHitObjectsProxiedContent() => null; + } +} diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/ManiaLegacySkinTransformer.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/ManiaLegacySkinTransformer.cs index 89f639e2fe..7e2a8823b6 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/ManiaLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/ManiaLegacySkinTransformer.cs @@ -136,7 +136,8 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy string filename = this.GetManiaSkinConfig(hitresult_mapping[result])?.Value ?? default_hitresult_skin_filenames[result]; - return this.GetAnimation(filename, true, true); + var animation = this.GetAnimation(filename, true, true); + return animation == null ? null : new LegacyManiaJudgementPiece(result, animation); } public override SampleChannel GetSample(ISampleInfo sampleInfo) diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs index a3dcd0e57f..34d972e60f 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs @@ -5,7 +5,6 @@ using osu.Framework.Graphics; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; -using osuTK; namespace osu.Game.Rulesets.Mania.UI { @@ -20,37 +19,6 @@ namespace osu.Game.Rulesets.Mania.UI { } - protected override void ApplyMissAnimations() - { - if (!(JudgementBody.Drawable is DefaultManiaJudgementPiece)) - { - // this is temporary logic until mania's skin transformer returns IAnimatableJudgements - JudgementBody.ScaleTo(1.6f); - JudgementBody.ScaleTo(1, 100, Easing.In); - - JudgementBody.MoveTo(Vector2.Zero); - JudgementBody.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint); - - JudgementBody.RotateTo(0); - JudgementBody.RotateTo(40, 800, Easing.InQuint); - JudgementBody.FadeOutFromOne(800); - - LifetimeEnd = JudgementBody.LatestTransformEndTime; - } - - base.ApplyMissAnimations(); - } - - protected override void ApplyHitAnimations() - { - JudgementBody.ScaleTo(0.8f); - JudgementBody.ScaleTo(1, 250, Easing.OutElastic); - - JudgementBody.Delay(50) - .ScaleTo(0.75f, 250) - .FadeOut(200); - } - protected override Drawable CreateDefaultJudgement(HitResult result) => new DefaultManiaJudgementPiece(result); private class DefaultManiaJudgementPiece : DefaultJudgementPiece @@ -66,6 +34,27 @@ namespace osu.Game.Rulesets.Mania.UI JudgementText.Font = JudgementText.Font.With(size: 25); } + + public override void PlayAnimation() + { + base.PlayAnimation(); + + switch (Result) + { + case HitResult.None: + case HitResult.Miss: + break; + + default: + this.ScaleTo(0.8f); + this.ScaleTo(1, 250, Easing.OutElastic); + + this.Delay(50) + .ScaleTo(0.75f, 250) + .FadeOut(200); + break; + } + } } } } diff --git a/osu.Game.Rulesets.Mania/UI/Stage.cs b/osu.Game.Rulesets.Mania/UI/Stage.cs index d2f5e6902a..dc34bffab1 100644 --- a/osu.Game.Rulesets.Mania/UI/Stage.cs +++ b/osu.Game.Rulesets.Mania/UI/Stage.cs @@ -10,7 +10,6 @@ using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; -using osu.Game.Rulesets.Mania.Skinning; using osu.Game.Rulesets.Mania.UI.Components; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; @@ -107,6 +106,7 @@ namespace osu.Game.Rulesets.Mania.UI Anchor = Anchor.TopCentre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, + Y = HIT_TARGET_POSITION + 150 }, topLevelContainer = new Container { RelativeSizeAxes = Axes.Both } } @@ -181,12 +181,6 @@ namespace osu.Game.Rulesets.Mania.UI })); } - protected override void OnSkinChanged() - { - judgements.Y = CurrentSkin.GetManiaSkinConfig(LegacyManiaSkinConfigurationLookups.ScorePosition) - ?.Value ?? HIT_TARGET_POSITION + 150; - } - protected override void Update() { // Due to masking differences, it is not possible to get the width of the columns container automatically diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index 4f76198b9f..844a249769 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -20,20 +20,11 @@ namespace osu.Game.Rulesets.UI.Scrolling [Resolved] protected IScrollingInfo ScrollingInfo { get; private set; } - protected ISkinSource CurrentSkin { get; private set; } [BackgroundDependencyLoader] private void load(ISkinSource skin) { Direction.BindTo(ScrollingInfo.Direction); - CurrentSkin = skin; - - skin.SourceChanged += OnSkinChanged; - OnSkinChanged(); - } - - protected virtual void OnSkinChanged() - { } /// From 028909353c8dc5b027a05ae5fb995ee278db9ede Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 14 Dec 2020 13:15:52 +0900 Subject: [PATCH 26/35] Revert one more change --- osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index 844a249769..475300c483 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.UI.Scrolling protected IScrollingInfo ScrollingInfo { get; private set; } [BackgroundDependencyLoader] - private void load(ISkinSource skin) + private void load() { Direction.BindTo(ScrollingInfo.Direction); } From d96399ea42130f3727d0188aa1ec8a0855c0b4b7 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 14 Dec 2020 13:18:14 +0900 Subject: [PATCH 27/35] Revert "Remove X setter from CatchHitObject" This reverts commit 7cbbd74d --- .../Mods/TestSceneCatchModRelax.cs | 8 +++---- .../TestSceneAutoJuiceStream.cs | 2 +- .../TestSceneCatchModHidden.cs | 2 +- .../TestSceneCatchStacker.cs | 2 +- .../TestSceneCatcher.cs | 22 +++++++++---------- .../TestSceneCatcherArea.cs | 2 +- .../TestSceneDrawableHitObjects.cs | 6 ++--- .../TestSceneHyperDash.cs | 14 ++++++------ .../TestSceneJuiceStream.cs | 4 ++-- .../Beatmaps/CatchBeatmapConverter.cs | 4 ++-- .../Objects/CatchHitObject.cs | 8 +++++++ .../Objects/JuiceStream.cs | 6 ++--- 12 files changed, 44 insertions(+), 36 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs b/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs index da4834aa73..c01aff0aa0 100644 --- a/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs +++ b/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs @@ -32,22 +32,22 @@ namespace osu.Game.Rulesets.Catch.Tests.Mods { new Fruit { - OriginalX = CatchPlayfield.CENTER_X, + X = CatchPlayfield.CENTER_X, StartTime = 0 }, new Fruit { - OriginalX = 0, + X = 0, StartTime = 1000 }, new Fruit { - OriginalX = CatchPlayfield.WIDTH, + X = CatchPlayfield.WIDTH, StartTime = 2000 }, new JuiceStream { - OriginalX = CatchPlayfield.CENTER_X, + X = CatchPlayfield.CENTER_X, StartTime = 3000, Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, Vector2.UnitY * 200 }) } diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs index 45cf5095f6..f552c3c27b 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneAutoJuiceStream.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Catch.Tests beatmap.HitObjects.Add(new JuiceStream { - OriginalX = CatchPlayfield.CENTER_X - width / 2, + X = CatchPlayfield.CENTER_X - width / 2, Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs index 6af9c88088..f15da29993 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchModHidden.cs @@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Catch.Tests { StartTime = 1000, Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, new Vector2(0, -192) }), - OriginalX = CatchPlayfield.WIDTH / 2 + X = CatchPlayfield.WIDTH / 2 } } }, diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs index d7835bd8c4..1ff31697b8 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatchStacker.cs @@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Catch.Tests { beatmap.HitObjects.Add(new Fruit { - OriginalX = (0.5f + i / 2048f * (i % 10 - 5)) * CatchPlayfield.WIDTH, + X = (0.5f + i / 2048f * (i % 10 - 5)) * CatchPlayfield.WIDTH, StartTime = i * 100, NewCombo = i % 8 == 0 }); diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs index d57e8e027e..e8bb57cdf3 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcher.cs @@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Catch.Tests JudgementResult result2 = null; AddStep("catch hyper fruit", () => { - attemptCatch(new Fruit { HyperDashTarget = new Fruit { OriginalX = 100 } }, out drawableObject1, out result1); + attemptCatch(new Fruit { HyperDashTarget = new Fruit { X = 100 } }, out drawableObject1, out result1); }); AddStep("catch normal fruit", () => { @@ -107,14 +107,14 @@ namespace osu.Game.Rulesets.Catch.Tests var halfWidth = Catcher.CalculateCatchWidth(new BeatmapDifficulty { CircleSize = 0 }) / 2; AddStep("catch fruit", () => { - attemptCatch(new Fruit { OriginalX = -halfWidth + 1 }); - attemptCatch(new Fruit { OriginalX = halfWidth - 1 }); + attemptCatch(new Fruit { X = -halfWidth + 1 }); + attemptCatch(new Fruit { X = halfWidth - 1 }); }); checkPlate(2); AddStep("miss fruit", () => { - attemptCatch(new Fruit { OriginalX = -halfWidth - 1 }); - attemptCatch(new Fruit { OriginalX = halfWidth + 1 }); + attemptCatch(new Fruit { X = -halfWidth - 1 }); + attemptCatch(new Fruit { X = halfWidth + 1 }); }); checkPlate(2); } @@ -122,7 +122,7 @@ namespace osu.Game.Rulesets.Catch.Tests [Test] public void TestFruitChangesCatcherState() { - AddStep("miss fruit", () => attemptCatch(new Fruit { OriginalX = 100 })); + AddStep("miss fruit", () => attemptCatch(new Fruit { X = 100 })); checkState(CatcherAnimationState.Fail); AddStep("catch fruit", () => attemptCatch(new Fruit())); checkState(CatcherAnimationState.Idle); @@ -135,7 +135,7 @@ namespace osu.Game.Rulesets.Catch.Tests { AddStep("catch hyper fruit", () => attemptCatch(new Fruit { - HyperDashTarget = new Fruit { OriginalX = 100 } + HyperDashTarget = new Fruit { X = 100 } })); checkHyperDash(true); AddStep("catch normal fruit", () => attemptCatch(new Fruit())); @@ -147,10 +147,10 @@ namespace osu.Game.Rulesets.Catch.Tests { AddStep("catch hyper kiai fruit", () => attemptCatch(new TestKiaiFruit { - HyperDashTarget = new Fruit { OriginalX = 100 } + HyperDashTarget = new Fruit { X = 100 } })); AddStep("catch tiny droplet", () => attemptCatch(new TinyDroplet())); - AddStep("miss tiny droplet", () => attemptCatch(new TinyDroplet { OriginalX = 100 })); + AddStep("miss tiny droplet", () => attemptCatch(new TinyDroplet { X = 100 })); // catcher state and hyper dash state is preserved checkState(CatcherAnimationState.Kiai); checkHyperDash(true); @@ -161,9 +161,9 @@ namespace osu.Game.Rulesets.Catch.Tests { AddStep("catch hyper kiai fruit", () => attemptCatch(new TestKiaiFruit { - HyperDashTarget = new Fruit { OriginalX = 100 } + HyperDashTarget = new Fruit { X = 100 } })); - AddStep("miss banana", () => attemptCatch(new Banana { OriginalX = 100 })); + AddStep("miss banana", () => attemptCatch(new Banana { X = 100 })); // catcher state is preserved but hyper dash state is reset checkState(CatcherAnimationState.Kiai); checkHyperDash(false); diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs index 423c3b7a13..5079e57e5e 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Catch.Tests AddStep("catch fruit", () => attemptCatch(new Fruit())); AddStep("catch fruit last in combo", () => attemptCatch(new Fruit { LastInCombo = true })); AddStep("catch kiai fruit", () => attemptCatch(new TestSceneCatcher.TestKiaiFruit())); - AddStep("miss last in combo", () => attemptCatch(new Fruit { OriginalX = 100, LastInCombo = true })); + AddStep("miss last in combo", () => attemptCatch(new Fruit { X = 100, LastInCombo = true })); } private void attemptCatch(Fruit fruit) diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs index 2db534e8c9..3e4995482d 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneDrawableHitObjects.cs @@ -105,7 +105,7 @@ namespace osu.Game.Rulesets.Catch.Tests { var fruit = new Fruit { - OriginalX = getXCoords(hit), + X = getXCoords(hit), LastInCombo = i % 4 == 0, StartTime = playfieldTime + 800 + (200 * i) }; @@ -122,7 +122,7 @@ namespace osu.Game.Rulesets.Catch.Tests var juice = new JuiceStream { - OriginalX = xCoords, + X = xCoords, StartTime = playfieldTime + 1000, Path = new SliderPath(PathType.Linear, new[] { @@ -145,7 +145,7 @@ namespace osu.Game.Rulesets.Catch.Tests { var banana = new Banana { - OriginalX = getXCoords(hit), + X = getXCoords(hit), LastInCombo = i % 4 == 0, StartTime = playfieldTime + 800 + (200 * i) }; diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs index 67af3c4420..db09b2bc6b 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneHyperDash.cs @@ -70,20 +70,20 @@ namespace osu.Game.Rulesets.Catch.Tests beatmap.ControlPointInfo.Add(0, new TimingControlPoint()); // Should produce a hyper-dash (edge case test) - beatmap.HitObjects.Add(new Fruit { StartTime = 1816, OriginalX = 56, NewCombo = true }); - beatmap.HitObjects.Add(new Fruit { StartTime = 2008, OriginalX = 308, NewCombo = true }); + beatmap.HitObjects.Add(new Fruit { StartTime = 1816, X = 56, NewCombo = true }); + beatmap.HitObjects.Add(new Fruit { StartTime = 2008, X = 308, NewCombo = true }); double startTime = 3000; const float left_x = 0.02f * CatchPlayfield.WIDTH; const float right_x = 0.98f * CatchPlayfield.WIDTH; - createObjects(() => new Fruit { OriginalX = left_x }); + createObjects(() => new Fruit { X = left_x }); createObjects(() => new TestJuiceStream(right_x), 1); createObjects(() => new TestJuiceStream(left_x), 1); - createObjects(() => new Fruit { OriginalX = right_x }); - createObjects(() => new Fruit { OriginalX = left_x }); - createObjects(() => new Fruit { OriginalX = right_x }); + createObjects(() => new Fruit { X = right_x }); + createObjects(() => new Fruit { X = left_x }); + createObjects(() => new Fruit { X = right_x }); createObjects(() => new TestJuiceStream(left_x), 1); beatmap.ControlPointInfo.Add(startTime, new TimingControlPoint @@ -121,7 +121,7 @@ namespace osu.Game.Rulesets.Catch.Tests { public TestJuiceStream(float x) { - OriginalX = x; + X = x; Path = new SliderPath(new[] { diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs index dbcf382d62..269e783899 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneJuiceStream.cs @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Catch.Tests { new JuiceStream { - OriginalX = CatchPlayfield.CENTER_X, + X = CatchPlayfield.CENTER_X, Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Catch.Tests }, new Banana { - OriginalX = CatchPlayfield.CENTER_X, + X = CatchPlayfield.CENTER_X, StartTime = 1000, NewCombo = true } diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index 55e86a7be2..34964fc4ae 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps Path = curveData.Path, NodeSamples = curveData.NodeSamples, RepeatCount = curveData.RepeatCount, - OriginalX = positionData?.X ?? 0, + X = positionData?.X ?? 0, NewCombo = comboData?.NewCombo ?? false, ComboOffset = comboData?.ComboOffset ?? 0, LegacyLastTickOffset = (obj as IHasLegacyLastTickOffset)?.LegacyLastTickOffset ?? 0 @@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps Samples = obj.Samples, NewCombo = comboData?.NewCombo ?? false, ComboOffset = comboData?.ComboOffset ?? 0, - OriginalX = positionData?.X ?? 0 + X = positionData?.X ?? 0 }.Yield(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index ebbbd44960..e689d6a178 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -33,6 +33,14 @@ namespace osu.Game.Rulesets.Catch.Objects float IHasXPosition.X => OriginalX; + /// + /// An alias of setter. + /// + public float X + { + set => OriginalX = value; + } + public readonly Bindable EffectiveXBindable = new Bindable(); /// diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs index bda0457c83..35fd58826e 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs @@ -75,7 +75,7 @@ namespace osu.Game.Rulesets.Catch.Objects AddNested(new TinyDroplet { StartTime = t + lastEvent.Value.Time, - OriginalX = OriginalX + Path.PositionAt( + X = OriginalX + Path.PositionAt( lastEvent.Value.PathProgress + (t / sinceLastTick) * (e.PathProgress - lastEvent.Value.PathProgress)).X, }); } @@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.Catch.Objects { Samples = dropletSamples, StartTime = e.Time, - OriginalX = OriginalX + Path.PositionAt(e.PathProgress).X, + X = OriginalX + Path.PositionAt(e.PathProgress).X, }); break; @@ -104,7 +104,7 @@ namespace osu.Game.Rulesets.Catch.Objects { Samples = this.GetNodeSamples(nodeIndex++), StartTime = e.Time, - OriginalX = OriginalX + Path.PositionAt(e.PathProgress).X, + X = OriginalX + Path.PositionAt(e.PathProgress).X, }); break; } From 0ad256a7626c6aa28c97f64ecc9bc9a1940c2f87 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 14 Dec 2020 13:18:32 +0900 Subject: [PATCH 28/35] Fix comment --- osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index e689d6a178..6267eca7de 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Catch.Objects private float xOffset; /// - /// A random offset applied to the horizontal value, set by the . + /// A random offset applied to the horizontal position, set by the . /// internal float XOffset { From 2e88e283d84c0547fd2f8272be87de6ccd8375d2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 14 Dec 2020 13:20:51 +0900 Subject: [PATCH 29/35] Remove unused using --- osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index 475300c483..2b75f93f9e 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -4,7 +4,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Skinning; using osuTK; namespace osu.Game.Rulesets.UI.Scrolling From 5b5e883904298074b80671e87e0b88eca883127c Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 14 Dec 2020 13:39:07 +0900 Subject: [PATCH 30/35] Remove EffectiveXBindable (setting Value was not handled) And use orthogonal `OriginalXBindable` and `XOffsetBindable`. --- .../TestSceneCatcherArea.cs | 2 +- .../Objects/CatchHitObject.cs | 52 +++++++------------ .../Drawables/DrawableCatchHitObject.cs | 9 ++-- .../DrawablePalpableCatchHitObject.cs | 6 +-- 4 files changed, 29 insertions(+), 40 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs index 5079e57e5e..1cbfa6338e 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestSceneCatcherArea.cs @@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Catch.Tests private void attemptCatch(Fruit fruit) { - fruit.OriginalX += catcher.X; + fruit.X = fruit.OriginalX + catcher.X; fruit.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = circleSize diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index 6267eca7de..ae45182960 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -4,7 +4,6 @@ using osu.Framework.Bindables; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Rulesets.Catch.Beatmaps; using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; @@ -21,46 +20,40 @@ namespace osu.Game.Rulesets.Catch.Objects /// /// The horizontal position of the hit object between 0 and . /// - /// - /// This value is the original value specified in the beatmap, not affected by beatmap processing. - /// It should be used instead of when working on a beatmap, not a gameplay. - /// - public float OriginalX + public float X { - get => OriginalXBindable.Value; set => OriginalXBindable.Value = value; } - float IHasXPosition.X => OriginalX; + float IHasXPosition.X => OriginalXBindable.Value; + + public readonly Bindable XOffsetBindable = new Bindable(); /// - /// An alias of setter. + /// A random offset applied to the horizontal position, set by the beatmap processing. /// - public float X + public float XOffset { - set => OriginalX = value; + set => XOffsetBindable.Value = value; } - public readonly Bindable EffectiveXBindable = new Bindable(); + /// + /// The horizontal position of the hit object between 0 and . + /// + /// + /// This value is the original value specified in the beatmap, not affected by the beatmap processing. + /// Use for a gameplay. + /// + public float OriginalX => OriginalXBindable.Value; /// /// The effective horizontal position of the hit object between 0 and . /// - public float EffectiveX => EffectiveXBindable.Value; - - private float xOffset; - - /// - /// A random offset applied to the horizontal position, set by the . - /// - internal float XOffset - { - set - { - xOffset = value; - EffectiveXBindable.Value = OriginalX + xOffset; - } - } + /// + /// This value is the original value plus the offset applied by the beatmap processing. + /// Use if a value not affected by the offset is desired. + /// + public float EffectiveX => OriginalXBindable.Value + XOffsetBindable.Value; public double TimePreempt = 1000; @@ -127,10 +120,5 @@ namespace osu.Game.Rulesets.Catch.Objects } protected override HitWindows CreateHitWindows() => HitWindows.Empty; - - protected CatchHitObject() - { - OriginalXBindable.BindValueChanged(change => EffectiveXBindable.Value = change.NewValue + xOffset); - } } } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs index edd607a443..0c065948ef 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawableCatchHitObject.cs @@ -15,7 +15,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables { public abstract class DrawableCatchHitObject : DrawableHitObject { - public readonly Bindable EffectiveXBindable = new Bindable(); + public readonly Bindable OriginalXBindable = new Bindable(); + public readonly Bindable XOffsetBindable = new Bindable(); protected override double InitialLifetimeOffset => HitObject.TimePreempt; @@ -38,14 +39,16 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables { base.OnApply(); - EffectiveXBindable.BindTo(HitObject.EffectiveXBindable); + OriginalXBindable.BindTo(HitObject.OriginalXBindable); + XOffsetBindable.BindTo(HitObject.XOffsetBindable); } protected override void OnFree() { base.OnFree(); - EffectiveXBindable.UnbindFrom(HitObject.EffectiveXBindable); + OriginalXBindable.UnbindFrom(HitObject.OriginalXBindable); + XOffsetBindable.UnbindFrom(HitObject.XOffsetBindable); } public Func CheckPosition; diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawablePalpableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawablePalpableCatchHitObject.cs index d3fa43c6b6..84af7922f9 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawablePalpableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawablePalpableCatchHitObject.cs @@ -55,10 +55,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables [BackgroundDependencyLoader] private void load() { - EffectiveXBindable.BindValueChanged(x => - { - X = x.NewValue; - }, true); + OriginalXBindable.BindValueChanged(_ => X = OriginalXBindable.Value + XOffsetBindable.Value); + XOffsetBindable.BindValueChanged(_ => X = OriginalXBindable.Value + XOffsetBindable.Value, true); ScaleBindable.BindValueChanged(scale => { From b81dbfc1921dabe9b846d752c7b4ca2a2a347c6d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 14 Dec 2020 13:56:46 +0900 Subject: [PATCH 31/35] Move shared implementation to a named function --- .../Objects/Drawables/DrawablePalpableCatchHitObject.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawablePalpableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawablePalpableCatchHitObject.cs index 84af7922f9..27cd7ed2bc 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawables/DrawablePalpableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawables/DrawablePalpableCatchHitObject.cs @@ -55,8 +55,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables [BackgroundDependencyLoader] private void load() { - OriginalXBindable.BindValueChanged(_ => X = OriginalXBindable.Value + XOffsetBindable.Value); - XOffsetBindable.BindValueChanged(_ => X = OriginalXBindable.Value + XOffsetBindable.Value, true); + OriginalXBindable.BindValueChanged(updateXPosition); + XOffsetBindable.BindValueChanged(updateXPosition, true); ScaleBindable.BindValueChanged(scale => { @@ -67,6 +67,11 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables IndexInBeatmap.BindValueChanged(_ => UpdateComboColour()); } + private void updateXPosition(ValueChangedEvent _) + { + X = OriginalXBindable.Value + XOffsetBindable.Value; + } + protected override void OnApply() { base.OnApply(); From a835ca9612e29fa71d66c852a0e4f5401bd3a465 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 14 Dec 2020 14:20:43 +0900 Subject: [PATCH 32/35] Fix anchors/origins for legacy pieces --- .../Skinning/Legacy/LegacyManiaJudgementPiece.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaJudgementPiece.cs b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaJudgementPiece.cs index 464d754205..9684cbb167 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaJudgementPiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaJudgementPiece.cs @@ -40,7 +40,13 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy Y = scorePosition ?? 0; if (animation != null) - InternalChild = animation; + { + InternalChild = animation.With(d => + { + d.Anchor = Anchor.Centre; + d.Origin = Anchor.Centre; + }); + } } public void PlayAnimation() From 0d7f53b0b9b8d83835ac16aaf32d032c15b68dc9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 14 Dec 2020 14:21:21 +0900 Subject: [PATCH 33/35] Fix gameplay loading too fast the first time entering a beatmap --- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 729119fa36..f59b36bc42 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -189,7 +189,7 @@ namespace osu.Game.Screens.Play // after an initial delay, start the debounced load check. // this will continue to execute even after resuming back on restart. - Scheduler.Add(new ScheduledDelegate(pushWhenLoaded, 1800, 0)); + Scheduler.Add(new ScheduledDelegate(pushWhenLoaded, Clock.CurrentTime + 1800, 0)); showMuteWarningIfNeeded(); } From 704150306324135bbb6ba4957627619fa294548c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 14 Dec 2020 15:34:32 +0900 Subject: [PATCH 34/35] Avoid intermediary delegate --- .../Objects/Drawables/DrawableBarLine.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs index e7dd9a18c2..9e50faabc1 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs @@ -111,13 +111,13 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void LoadComplete() { base.LoadComplete(); - major.BindValueChanged(majorChanged => updateMajor(majorChanged.NewValue), true); + major.BindValueChanged(updateMajor); } - private void updateMajor(bool major) + private void updateMajor(ValueChangedEvent major) { - line.Alpha = major ? 1f : 0.75f; - triangleContainer.Alpha = major ? 1 : 0; + line.Alpha = major.NewValue ? 1f : 0.75f; + triangleContainer.Alpha = major.NewValue ? 1 : 0; } protected override void OnApply() From 79768f0aa412f00fa6d8e45101038cd8417e2c78 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 14 Dec 2020 17:52:38 +0900 Subject: [PATCH 35/35] Update framework --- osu.Android.props | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index eaedcb7bc3..2a08cb7867 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,6 +52,6 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b4c7dca12f..960959f367 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -26,7 +26,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 7542aded86..a5bcb91c74 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -70,7 +70,7 @@ - + @@ -88,7 +88,7 @@ - +