From 5352da277d3cf46b3997d426b92ad8cb2510e4de Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 08:16:19 +0930 Subject: [PATCH 01/33] Remove ScaleFixContainer. --- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 214 +++++++------------ 1 file changed, 78 insertions(+), 136 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index b0fb9d7f28..1f83e36c14 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -56,111 +56,104 @@ namespace osu.Game.Rulesets.Taiko.UI { AddRangeInternal(new Drawable[] { - new ScaleFixContainer + backgroundContainer = new Container { - RelativeSizeAxes = Axes.X, - Height = DEFAULT_PLAYFIELD_HEIGHT, - Children = new[] + Name = "Transparent playfield background", + RelativeSizeAxes = Axes.Both, + BorderThickness = 2, + Masking = true, + EdgeEffect = new EdgeEffectParameters { - backgroundContainer = new Container + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.2f), + Radius = 5, + }, + Children = new Drawable[] + { + background = new Box { - Name = "Transparent playfield background", RelativeSizeAxes = Axes.Both, - BorderThickness = 2, - Masking = true, - EdgeEffect = new EdgeEffectParameters - { - Type = EdgeEffectType.Shadow, - Colour = Color4.Black.Opacity(0.2f), - Radius = 5, - }, - Children = new Drawable[] - { - background = new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0.6f - }, - } + Alpha = 0.6f }, + } + }, + new Container + { + Name = "Right area", + RelativeSizeAxes = Axes.Both, + Margin = new MarginPadding { Left = left_area_size }, + Children = new Drawable[] + { new Container { - Name = "Right area", + Name = "Masked elements", RelativeSizeAxes = Axes.Both, - Margin = new MarginPadding { Left = left_area_size }, + Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, + Masking = true, Children = new Drawable[] { - new Container + hitExplosionContainer = new Container + { + RelativeSizeAxes = Axes.Y, + BlendingMode = BlendingMode.Additive, + }, + barLineContainer = new Container { - Name = "Masked elements", RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, - Masking = true, - Children = new Drawable[] - { - hitExplosionContainer = new Container - { - RelativeSizeAxes = Axes.Y, - BlendingMode = BlendingMode.Additive, - }, - barLineContainer = new Container - { - RelativeSizeAxes = Axes.Both, - }, - new HitTarget - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.Centre, - }, - hitObjectContainer = new Container - { - RelativeSizeAxes = Axes.Both, - }, - } }, - kiaiExplosionContainer = new Container + new HitTarget { - Name = "Kiai hit explosions", - RelativeSizeAxes = Axes.Y, - Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, - BlendingMode = BlendingMode.Additive + Anchor = Anchor.CentreLeft, + Origin = Anchor.Centre, }, - judgementContainer = new Container + hitObjectContainer = new Container { - Name = "Judgements", - RelativeSizeAxes = Axes.Y, - Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, - BlendingMode = BlendingMode.Additive + RelativeSizeAxes = Axes.Both, }, } }, - overlayBackgroundContainer = new Container + kiaiExplosionContainer = new Container { - Name = "Left overlay", - Size = new Vector2(left_area_size, DEFAULT_PLAYFIELD_HEIGHT), - BorderThickness = 1, - Children = new Drawable[] - { - overlayBackground = new Box - { - RelativeSizeAxes = Axes.Both, - }, - new InputDrum - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativePositionAxes = Axes.X, - Position = new Vector2(0.10f, 0), - Scale = new Vector2(0.9f) - }, - new Box - { - Anchor = Anchor.TopRight, - RelativeSizeAxes = Axes.Y, - Width = 10, - Colour = Framework.Graphics.Colour.ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.6f), Color4.Black.Opacity(0)), - }, - } + Name = "Kiai hit explosions", + RelativeSizeAxes = Axes.Y, + Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, + BlendingMode = BlendingMode.Additive + }, + judgementContainer = new Container + { + Name = "Judgements", + RelativeSizeAxes = Axes.Y, + Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, + BlendingMode = BlendingMode.Additive + }, + } + }, + overlayBackgroundContainer = new Container + { + Name = "Left overlay", + RelativeSizeAxes = Axes.Y, + Size = new Vector2(left_area_size, 1), + BorderThickness = 1, + Children = new Drawable[] + { + overlayBackground = new Box + { + RelativeSizeAxes = Axes.Both, + }, + new InputDrum + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativePositionAxes = Axes.X, + Position = new Vector2(0.10f, 0), + Scale = new Vector2(0.9f) + }, + new Box + { + Anchor = Anchor.TopRight, + RelativeSizeAxes = Axes.Y, + Width = 10, + Colour = Framework.Graphics.Colour.ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.6f), Color4.Black.Opacity(0)), }, } }, @@ -233,56 +226,5 @@ namespace osu.Game.Rulesets.Taiko.UI else hitExplosionContainer.Children.FirstOrDefault(e => e.Judgement == judgedObject.Judgement)?.VisualiseSecondHit(); } - - /// - /// This is a very special type of container. It serves a similar purpose to , however unlike , - /// this will only adjust the scale relative to the height of its parent and will maintain the original width relative to its parent. - /// - /// - /// By adjusting the scale relative to the height of its parent, the aspect ratio of this container's children is maintained, however this is undesirable - /// in the case where the hit object container should not have its width adjusted by scale. To counteract this, another container is nested inside this - /// container which takes care of reversing the width adjustment while appearing transparent to the user. - /// - /// - private class ScaleFixContainer : Container - { - protected override Container Content => widthAdjustmentContainer; - private readonly WidthAdjustmentContainer widthAdjustmentContainer; - - /// - /// We only want to apply DrawScale in the Y-axis to preserve aspect ratio and doesn't care about having its width adjusted. - /// - protected override Vector2 DrawScale => Scale * RelativeToAbsoluteFactor.Y / DrawHeight; - - public ScaleFixContainer() - { - AddInternal(widthAdjustmentContainer = new WidthAdjustmentContainer { ParentDrawScaleReference = () => DrawScale.X }); - } - - /// - /// The container type that reverses the width adjustment. - /// - private class WidthAdjustmentContainer : Container - { - /// - /// This container needs to know its parent's so it can reverse the width adjustment caused by . - /// - public Func ParentDrawScaleReference; - - public WidthAdjustmentContainer() - { - // This container doesn't care about height, it should always fill its parent - RelativeSizeAxes = Axes.Y; - } - - protected override void Update() - { - base.Update(); - - // Reverse the DrawScale adjustment - Width = Parent.DrawSize.X / ParentDrawScaleReference(); - } - } - } } } \ No newline at end of file From 358b7c9d3d5ce2d9f1c71aa7004018acf33e93d7 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 08:19:25 +0930 Subject: [PATCH 02/33] Better InputDrum sizing + positioning. --- osu.Game.Rulesets.Taiko/UI/InputDrum.cs | 8 +++++--- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 9 ++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs index 60881f3c24..0255171284 100644 --- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -21,9 +21,10 @@ namespace osu.Game.Rulesets.Taiko.UI { public InputDrum() { - Size = new Vector2(TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT); + RelativeSizeAxes = Axes.Both; + FillMode = FillMode.Fit; - const float middle_split = 10; + const float middle_split = 0.025f; Children = new Drawable[] { @@ -33,6 +34,7 @@ namespace osu.Game.Rulesets.Taiko.UI Anchor = Anchor.Centre, Origin = Anchor.CentreRight, RelativeSizeAxes = Axes.Both, + RelativePositionAxes = Axes.X, X = -middle_split / 2, RimKey = Key.D, CentreKey = Key.F @@ -43,8 +45,8 @@ namespace osu.Game.Rulesets.Taiko.UI Anchor = Anchor.Centre, Origin = Anchor.CentreLeft, RelativeSizeAxes = Axes.Both, + RelativePositionAxes = Axes.X, X = middle_split / 2, - Position = new Vector2(-1f, 0), RimKey = Key.K, CentreKey = Key.J } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 1f83e36c14..62f4ddd052 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -142,11 +142,10 @@ namespace osu.Game.Rulesets.Taiko.UI }, new InputDrum { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativePositionAxes = Axes.X, - Position = new Vector2(0.10f, 0), - Scale = new Vector2(0.9f) + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Scale = new Vector2(0.9f), + Margin = new MarginPadding { Right = 20 } }, new Box { From 13af804bbba669cfcfdf6d04bdc225d7475c52df Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 13:11:53 +0930 Subject: [PATCH 03/33] Fix TestCaseTaikoPlayfield not correctly setting strong hit objects. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 8ca129eb91..1faeb7dc35 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -18,7 +18,7 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCaseTaikoPlayfield : TestCase { - private const double default_duration = 300; + private const double default_duration = 1000; private const float scroll_time = 1000; public override string Description => "Taiko playfield"; @@ -180,7 +180,8 @@ namespace osu.Desktop.VisualTests.Tests Hit h = new Hit { StartTime = playfield.Time.Current + scroll_time, - ScrollTime = scroll_time + ScrollTime = scroll_time, + IsStrong = strong }; if (strong) @@ -194,7 +195,8 @@ namespace osu.Desktop.VisualTests.Tests Hit h = new Hit { StartTime = playfield.Time.Current + scroll_time, - ScrollTime = scroll_time + ScrollTime = scroll_time, + IsStrong = strong }; if (strong) From 17cad7605492370f31a07a46d43a1426eeb95583 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 13:33:46 +0930 Subject: [PATCH 04/33] Make TestCaseTaikoPlayfield able to visualise kiai hits. --- .../Tests/TestCaseTaikoPlayfield.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 1faeb7dc35..f5cc7f3120 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -13,6 +13,8 @@ using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects.Drawables; using osu.Game.Rulesets.Taiko.UI; using System; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Beatmaps; namespace osu.Desktop.VisualTests.Tests { @@ -31,7 +33,8 @@ namespace osu.Desktop.VisualTests.Tests public TestCaseTaikoPlayfield() { - AddStep("Hit!", addHitJudgement); + AddStep("Hit!", () => addHitJudgement(false)); + AddStep("Kiai hit", () => addHitJudgement(true)); AddStep("Miss :(", addMissJudgement); AddStep("DrumRoll", () => addDrumRoll(false)); AddStep("Strong DrumRoll", () => addDrumRoll(true)); @@ -102,11 +105,20 @@ namespace osu.Desktop.VisualTests.Tests } } - private void addHitJudgement() + private void addHitJudgement(bool kiai) { TaikoHitResult hitResult = RNG.Next(2) == 0 ? TaikoHitResult.Good : TaikoHitResult.Great; - var h = new DrawableTestHit(new Hit()) + var cpi = new ControlPointInfo(); + cpi.EffectPoints.Add(new EffectControlPoint + { + KiaiMode = kiai + }); + + Hit hit = new Hit(); + hit.ApplyDefaults(cpi, new BeatmapDifficulty()); + + var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == TaikoHitResult.Good ? -0.1f : -0.05f, hitResult == TaikoHitResult.Good ? 0.1f : 0.05f), Judgement = new TaikoJudgement From 324fd456a73550febc744411ae79228e2bf51a47 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 13:35:07 +0930 Subject: [PATCH 05/33] Rework border + fillmodes + size in TaikoPlayfield. --- .../Tests/TestCaseTaikoPlayfield.cs | 4 +-- .../UI/TaikoHitRenderer.cs | 2 +- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 36 ++++++++++++++----- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index f5cc7f3120..3f4d4e9722 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -59,7 +59,7 @@ namespace osu.Desktop.VisualTests.Tests Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, - Height = TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT, + Height = TaikoPlayfield.DEFAULT_HEIGHT, Clock = new FramedClock(rateAdjustClock), Children = new[] { @@ -100,7 +100,7 @@ namespace osu.Desktop.VisualTests.Tests playfieldContainer.Delay(delay).ResizeTo(new Vector2(1, rng.Next(25, 400)), 500); break; case 6: - playfieldContainer.Delay(delay).ResizeTo(new Vector2(1, TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT), 500); + playfieldContainer.Delay(delay).ResizeTo(new Vector2(TaikoPlayfield.DEFAULT_HEIGHT), 500); break; } } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs index 662cace511..570b4be488 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs @@ -85,7 +85,7 @@ namespace osu.Game.Rulesets.Taiko.UI protected override Vector2 GetPlayfieldAspectAdjust() { - const float default_relative_height = TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT / 768; + const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768; const float default_aspect = 16f / 9f; float aspectAdjust = MathHelper.Clamp(DrawWidth / DrawHeight, 0.4f, 4) / default_aspect; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 62f4ddd052..fff19b97c9 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -22,14 +22,14 @@ namespace osu.Game.Rulesets.Taiko.UI public class TaikoPlayfield : Playfield { /// - /// The default play field height. + /// Default height of a when inside a . /// - public const float DEFAULT_PLAYFIELD_HEIGHT = 178f; + public const float DEFAULT_HEIGHT = 178; /// /// The offset from which the center of the hit target lies at. /// - public const float HIT_TARGET_OFFSET = TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER / 2f + 40; + public const float HIT_TARGET_OFFSET = 100; /// /// The size of the left area of the playfield. This area contains the input drum. @@ -60,7 +60,6 @@ namespace osu.Game.Rulesets.Taiko.UI { Name = "Transparent playfield background", RelativeSizeAxes = Axes.Both, - BorderThickness = 2, Masking = true, EdgeEffect = new EdgeEffectParameters { @@ -81,7 +80,7 @@ namespace osu.Game.Rulesets.Taiko.UI { Name = "Right area", RelativeSizeAxes = Axes.Both, - Margin = new MarginPadding { Left = left_area_size }, + Padding = new MarginPadding { Left = left_area_size }, Children = new Drawable[] { new Container @@ -94,7 +93,8 @@ namespace osu.Game.Rulesets.Taiko.UI { hitExplosionContainer = new Container { - RelativeSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, BlendingMode = BlendingMode.Additive, }, barLineContainer = new Container @@ -105,6 +105,8 @@ namespace osu.Game.Rulesets.Taiko.UI { Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit }, hitObjectContainer = new Container { @@ -115,7 +117,8 @@ namespace osu.Game.Rulesets.Taiko.UI kiaiExplosionContainer = new Container { Name = "Kiai hit explosions", - RelativeSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, BlendingMode = BlendingMode.Additive }, @@ -133,7 +136,6 @@ namespace osu.Game.Rulesets.Taiko.UI Name = "Left overlay", RelativeSizeAxes = Axes.Y, Size = new Vector2(left_area_size, 1), - BorderThickness = 1, Children = new Drawable[] { overlayBackground = new Box @@ -156,6 +158,24 @@ namespace osu.Game.Rulesets.Taiko.UI }, } }, + new Container + { + Name = "Border", + RelativeSizeAxes = Axes.Both, + Masking = true, + MaskingSmoothness = 0, + BorderThickness = 2, + AlwaysPresent = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + } + } + }, topLevelHitContainer = new Container { Name = "Top level hit objects", From 22ffc787578b1af7bd5d056b55883bdd44b6a4fa Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 13:36:04 +0930 Subject: [PATCH 06/33] Rework consts in TaikoHitObject to be relative size values. --- .../Objects/TaikoHitObject.cs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs index db368cb112..5f3223e918 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs @@ -11,24 +11,19 @@ namespace osu.Game.Rulesets.Taiko.Objects public abstract class TaikoHitObject : HitObject { /// - /// Diameter of a circle relative to the size of the . + /// Default size of a . /// - public const float PLAYFIELD_RELATIVE_DIAMETER = 0.45f; + public const float DEFAULT_SIZE = 0.45f; /// - /// Scale multiplier for a strong circle. + /// Scale multiplier for a strong . /// - public const float STRONG_CIRCLE_DIAMETER_SCALE = 1.4f; + public const float STRONG_SCALE = 1.4f; /// - /// Default circle diameter. + /// Default size of a strong . /// - public const float DEFAULT_CIRCLE_DIAMETER = TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT * PLAYFIELD_RELATIVE_DIAMETER; - - /// - /// Default strong circle diameter. - /// - public const float DEFAULT_STRONG_CIRCLE_DIAMETER = DEFAULT_CIRCLE_DIAMETER * STRONG_CIRCLE_DIAMETER_SCALE; + public const float DEFAULT_STRONG_SIZE = DEFAULT_SIZE * STRONG_SCALE; /// /// The time taken from the initial (off-screen) spawn position to the centre of the hit target for a of 1000ms. From d796730e36c34e4893e7c8f35de2d697f2ef058f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 13:36:15 +0930 Subject: [PATCH 07/33] Fix KiaiHitExplosion. --- osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs index 524490fac3..bac956a25b 100644 --- a/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs @@ -24,11 +24,11 @@ namespace osu.Game.Rulesets.Taiko.UI Judgement = judgement; - Anchor = Anchor.Centre; + Anchor = Anchor.CentreLeft; Origin = Anchor.Centre; - RelativeSizeAxes = Axes.Y; - Size = new Vector2(TaikoHitObject.DEFAULT_CIRCLE_DIAMETER, 1); + RelativeSizeAxes = Axes.Both; + Size = new Vector2(TaikoHitObject.DEFAULT_SIZE, 1); Masking = true; Alpha = 0.25f; From 14639ff8e37d08cebb0e500db6cf583642a22984 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 13:36:36 +0930 Subject: [PATCH 08/33] Fix HitTarget. --- osu.Game.Rulesets.Taiko/UI/HitTarget.cs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/HitTarget.cs b/osu.Game.Rulesets.Taiko/UI/HitTarget.cs index 1ca6e4eb34..8f3b6840f3 100644 --- a/osu.Game.Rulesets.Taiko/UI/HitTarget.cs +++ b/osu.Game.Rulesets.Taiko/UI/HitTarget.cs @@ -15,11 +15,6 @@ namespace osu.Game.Rulesets.Taiko.UI /// internal class HitTarget : Container { - /// - /// The 1px inner border of the taiko playfield. - /// - private const float border_offset = 1; - /// /// Thickness of all drawn line pieces. /// @@ -27,8 +22,6 @@ namespace osu.Game.Rulesets.Taiko.UI public HitTarget() { - Size = new Vector2(TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT); - Children = new Drawable[] { new Box @@ -36,8 +29,8 @@ namespace osu.Game.Rulesets.Taiko.UI Name = "Bar Upper", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Y = border_offset, - Size = new Vector2(border_thickness, (TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT - TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER) / 2f - border_offset), + RelativeSizeAxes = Axes.Y, + Size = new Vector2(border_thickness, (1 - TaikoHitObject.DEFAULT_STRONG_SIZE) / 2f), Alpha = 0.1f }, new CircularContainer @@ -45,7 +38,9 @@ namespace osu.Game.Rulesets.Taiko.UI Name = "Strong Hit Ring", Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER), + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + Scale = new Vector2(TaikoHitObject.DEFAULT_STRONG_SIZE), Masking = true, BorderColour = Color4.White, BorderThickness = border_thickness, @@ -65,7 +60,9 @@ namespace osu.Game.Rulesets.Taiko.UI Name = "Normal Hit Ring", Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(TaikoHitObject.DEFAULT_CIRCLE_DIAMETER), + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + Scale = new Vector2(TaikoHitObject.DEFAULT_SIZE), Masking = true, BorderColour = Color4.White, BorderThickness = border_thickness, @@ -85,8 +82,8 @@ namespace osu.Game.Rulesets.Taiko.UI Name = "Bar Lower", Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Y = -border_offset, - Size = new Vector2(border_thickness, (TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT - TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER) / 2f - border_offset), + RelativeSizeAxes = Axes.Y, + Size = new Vector2(border_thickness, (1 - TaikoHitObject.DEFAULT_STRONG_SIZE) / 2f), Alpha = 0.1f }, }; From b2d69dfa02268d9e56b9090cf84a75cdc96db7aa Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 13:36:49 +0930 Subject: [PATCH 09/33] Fix HitExplosion. --- osu.Game.Rulesets.Taiko/UI/HitExplosion.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs index c372ac1809..cb849a11c7 100644 --- a/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs @@ -30,10 +30,11 @@ namespace osu.Game.Rulesets.Taiko.UI Judgement = judgement; - Anchor = Anchor.Centre; + Anchor = Anchor.CentreLeft; Origin = Anchor.Centre; - Size = new Vector2(TaikoPlayfield.HIT_TARGET_OFFSET + TaikoHitObject.DEFAULT_CIRCLE_DIAMETER); + RelativeSizeAxes = Axes.Both; + Size = new Vector2(TaikoHitObject.DEFAULT_SIZE); RelativePositionAxes = Axes.Both; @@ -73,7 +74,7 @@ namespace osu.Game.Rulesets.Taiko.UI /// public void VisualiseSecondHit() { - this.ResizeTo(new Vector2(TaikoPlayfield.HIT_TARGET_OFFSET + TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER), 50); + this.ResizeTo(new Vector2(TaikoHitObject.DEFAULT_STRONG_SIZE), 50); } } } From 786bad3d71f4114762831dc093e0147eca3e3e90 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 13:53:12 +0930 Subject: [PATCH 10/33] Simplify + fix up circle pieces. --- .../Drawables/Pieces/CentreHitSymbolPiece.cs | 10 +++------- .../Objects/Drawables/Pieces/CirclePiece.cs | 19 +++++-------------- .../Drawables/Pieces/ElongatedCirclePiece.cs | 4 +++- .../Drawables/Pieces/RimHitSymbolPiece.cs | 2 ++ .../Drawables/Pieces/SwellSymbolPiece.cs | 7 ++++++- .../Objects/Drawables/Pieces/TaikoPiece.cs | 6 ++++-- .../Objects/Drawables/Pieces/TickPiece.cs | 8 ++++++-- 7 files changed, 29 insertions(+), 27 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs index cc88105e03..8ad548b3d6 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs @@ -17,15 +17,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { Anchor = Anchor.Centre; Origin = Anchor.Centre; + Size = new Vector2(CirclePiece.SYMBOL_INNER_SIZE); Masking = true; - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both - } - }; + + Children = new[] { new Box { RelativeSizeAxes = Axes.Both } }; } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index 698939e278..481f0a6fc8 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -9,6 +9,7 @@ using osu.Game.Graphics.Backgrounds; using OpenTK.Graphics; using osu.Game.Beatmaps.ControlPoints; using osu.Framework.Audio.Track; +using OpenTK; namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { @@ -21,7 +22,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces /// public class CirclePiece : TaikoPiece { - public const float SYMBOL_SIZE = TaikoHitObject.DEFAULT_CIRCLE_DIAMETER * 0.45f; + public const float SYMBOL_SIZE = 36; public const float SYMBOL_BORDER = 8; public const float SYMBOL_INNER_SIZE = SYMBOL_SIZE - 2 * SYMBOL_BORDER; private const double pre_beat_transition_time = 80; @@ -120,30 +121,20 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces }, content = new Container { - RelativeSizeAxes = Axes.Both, Name = "Content", Anchor = Anchor.Centre, Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, } }); if (isStrong) { - Size *= TaikoHitObject.STRONG_CIRCLE_DIAMETER_SCALE; - - //default for symbols etc. - Content.Scale *= TaikoHitObject.STRONG_CIRCLE_DIAMETER_SCALE; + content.Scale = new Vector2(TaikoHitObject.STRONG_SCALE); + content.Width = 1 / TaikoHitObject.STRONG_SCALE; } } - protected override void Update() - { - base.Update(); - - //we want to allow for width of content to remain mapped to the area inside us, regardless of the scale applied above. - Content.Width = 1 / Content.Scale.X; - } - private const float edge_alpha_kiai = 0.5f; private void resetEdgeEffects() diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs index f607e2040f..ce591335f8 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs @@ -18,8 +18,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces /// public float Length; - public ElongatedCirclePiece(bool isStrong = false) : base(isStrong) + public ElongatedCirclePiece(bool isStrong = false) + : base(isStrong) { + RelativeSizeAxes = Axes.Y; } protected override void Update() diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs index 704a27a96d..9745b6b42d 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs @@ -18,7 +18,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { Anchor = Anchor.Centre; Origin = Anchor.Centre; + Size = new Vector2(CirclePiece.SYMBOL_SIZE); + BorderThickness = CirclePiece.SYMBOL_BORDER; BorderColour = Color4.White; Masking = true; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs index 0f703837a9..8e5ab14bac 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs @@ -1,7 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using OpenTK; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Game.Graphics; namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces @@ -15,9 +18,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { Anchor = Anchor.Centre; Origin = Anchor.Centre; - UseFullGlyphHeight = true; + TextSize = CirclePiece.SYMBOL_INNER_SIZE; + Icon = FontAwesome.fa_asterisk; + UseFullGlyphHeight = true; Shadow = false; } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs index 5e7e9e6350..b942809172 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs @@ -5,6 +5,9 @@ using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; using osu.Game.Graphics.Containers; +using osu.Framework.Graphics; +using System; +using osu.Framework.Graphics.Containers; namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { @@ -35,8 +38,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces public TaikoPiece() { - //just a default - Size = new Vector2(TaikoHitObject.DEFAULT_CIRCLE_DIAMETER); + RelativeSizeAxes = Axes.Both; } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs index 2af65f2ed7..5f864bc554 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs @@ -15,12 +15,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces /// Any tick that is not the first for a drumroll is not filled, but is instead displayed /// as a hollow circle. This is what controls the border width of that circle. /// - private const float tick_border_width = TaikoHitObject.DEFAULT_CIRCLE_DIAMETER / 16; + private const float tick_border_width = 5; /// /// The size of a tick. /// - private const float tick_size = TaikoHitObject.DEFAULT_CIRCLE_DIAMETER / 6; + private const float tick_size = 14; private bool filled; public bool Filled @@ -37,6 +37,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces public TickPiece() { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + RelativeSizeAxes = Axes.None; Size = new Vector2(tick_size); Add(new CircularContainer From e55a406e4dff3d7483e3fb48686de9a7a8a56bf7 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 13:54:13 +0930 Subject: [PATCH 11/33] Fix DrawableTaikoHitObject + drawable hit objects. --- .../Objects/Drawables/DrawableDrumRoll.cs | 4 + .../Objects/Drawables/DrawableDrumRollTick.cs | 1 + .../Objects/Drawables/DrawableHit.cs | 1 + .../Objects/Drawables/DrawableSwell.cs | 116 ++++++++---------- .../Drawables/DrawableTaikoHitObject.cs | 18 +-- 5 files changed, 63 insertions(+), 77 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs index 4562501ed1..756eff6fdf 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -10,6 +10,7 @@ using osu.Game.Rulesets.Taiko.Judgements; using OpenTK; using OpenTK.Graphics; using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; +using osu.Framework.Graphics; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { @@ -30,6 +31,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables public DrawableDrumRoll(DrumRoll drumRoll) : base(drumRoll) { + RelativeSizeAxes = Axes.Y; + AutoSizeAxes = Axes.X; + foreach (var tick in drumRoll.Ticks) { var newTick = new DrawableDrumRollTick(tick) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs index b64bc64d9b..0e1cd05de3 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs @@ -15,6 +15,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables public DrawableDrumRollTick(DrumRollTick tick) : base(tick) { + FillMode = FillMode.Fit; } protected override TaikoPiece CreateMainPiece() => new TickPiece diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 0d5c8d2a25..de2decbda9 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -26,6 +26,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected DrawableHit(Hit hit) : base(hit) { + FillMode = FillMode.Fit; } protected override void CheckJudgement(bool userTriggered) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index a565f92fac..e861af03cf 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -35,8 +35,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private readonly CircularContainer targetRing; private readonly CircularContainer expandingRing; - private readonly CirclePiece circlePiece; - private readonly Key[] rimKeys = { Key.D, Key.K }; private readonly Key[] centreKeys = { Key.F, Key.J }; private Key[] lastKeySet; @@ -52,89 +50,81 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables public DrawableSwell(Swell swell) : base(swell) { - Children = new Drawable[] + FillMode = FillMode.Fit; + + Add(bodyContainer = new Container { - bodyContainer = new Container + RelativeSizeAxes = Axes.Both, + Depth = 1, + Children = new Drawable[] { - AutoSizeAxes = Axes.Both, - Children = new Drawable[] + expandingRing = new CircularContainer { - expandingRing = new CircularContainer + Name = "Expanding ring", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Alpha = 0, + RelativeSizeAxes = Axes.Both, + BlendingMode = BlendingMode.Additive, + Masking = true, + Children = new[] { - Name = "Expanding ring", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Alpha = 0, - Size = new Vector2(TaikoHitObject.DEFAULT_CIRCLE_DIAMETER), - BlendingMode = BlendingMode.Additive, - Masking = true, - Children = new[] + new Box { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = inner_ring_alpha, - } + RelativeSizeAxes = Axes.Both, + Alpha = inner_ring_alpha, } - }, - targetRing = new CircularContainer + } + }, + targetRing = new CircularContainer + { + Name = "Target ring (thick border)", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Masking = true, + BorderThickness = target_ring_thick_border, + BlendingMode = BlendingMode.Additive, + Children = new Drawable[] { - Name = "Target ring (thick border)", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(TaikoHitObject.DEFAULT_CIRCLE_DIAMETER), - Masking = true, - BorderThickness = target_ring_thick_border, - BlendingMode = BlendingMode.Additive, - Children = new Drawable[] + new Box { - new Box + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + }, + new CircularContainer + { + Name = "Target ring (thin border)", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Masking = true, + BorderThickness = target_ring_thin_border, + BorderColour = Color4.White, + Children = new[] { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true - }, - new CircularContainer - { - Name = "Target ring (thin border)", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Masking = true, - BorderThickness = target_ring_thin_border, - BorderColour = Color4.White, - Children = new[] + new Box { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true - } + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true } } } - }, - circlePiece = new CirclePiece - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Children = new[] - { - symbol = new SwellSymbolPiece() - } } } } - }; + }); + + MainPiece.Add(symbol = new SwellSymbolPiece()); - circlePiece.KiaiMode = HitObject.Kiai; } [BackgroundDependencyLoader] private void load(OsuColour colours) { - circlePiece.AccentColour = colours.YellowDark; + MainPiece.AccentColour = colours.YellowDark; expandingRing.Colour = colours.YellowLight; targetRing.BorderColour = colours.YellowDark.Opacity(0.25f); } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 24aa366944..84fe36e6d9 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -10,6 +10,7 @@ using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using OpenTK; using OpenTK.Input; +using System; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { @@ -24,12 +25,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables public override Vector2 OriginPosition => new Vector2(DrawHeight / 2); - protected override Container Content => bodyContainer; - protected readonly TaikoPiece MainPiece; - private readonly Container bodyContainer; - public new TaikoHitType HitObject; protected DrawableTaikoHitObject(TaikoHitType hitObject) @@ -40,19 +37,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables Anchor = Anchor.CentreLeft; Origin = Anchor.Custom; - AutoSizeAxes = Axes.Both; + RelativeSizeAxes = Axes.Both; + Size = new Vector2(HitObject.IsStrong ? TaikoHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE); RelativePositionAxes = Axes.X; - AddInternal(bodyContainer = new Container - { - AutoSizeAxes = Axes.Both, - Children = new[] - { - MainPiece = CreateMainPiece() - } - }); - + Add(MainPiece = CreateMainPiece()); MainPiece.KiaiMode = HitObject.Kiai; LifetimeStart = HitObject.StartTime - HitObject.ScrollTime * 2; From 8ef949ce38f8e7187525a5bbcc33cec96e073c37 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 13:56:36 +0930 Subject: [PATCH 12/33] Remove TestCaseTaikoHitObjects. --- .../Tests/TestCaseTaikoHitObjects.cs | 119 ------------------ .../osu.Desktop.VisualTests.csproj | 1 - 2 files changed, 120 deletions(-) delete mode 100644 osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs deleted file mode 100644 index d98e39ae7b..0000000000 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.Linq; -using OpenTK; -using OpenTK.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Testing; -using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; - -namespace osu.Desktop.VisualTests.Tests -{ - internal class TestCaseTaikoHitObjects : TestCase - { - public override string Description => "Taiko hit objects"; - - private bool kiai; - - public TestCaseTaikoHitObjects() - { - AddToggleStep("Kiai", b => - { - kiai = !kiai; - updateKiaiState(); - }); - - Add(new CirclePiece - { - Position = new Vector2(100, 100), - AccentColour = Color4.DarkRed, - KiaiMode = kiai, - Children = new[] - { - new CentreHitSymbolPiece() - } - }); - - Add(new CirclePiece(true) - { - Position = new Vector2(350, 100), - AccentColour = Color4.DarkRed, - KiaiMode = kiai, - Children = new[] - { - new CentreHitSymbolPiece() - } - }); - - Add(new CirclePiece - { - Position = new Vector2(100, 300), - AccentColour = Color4.DarkBlue, - KiaiMode = kiai, - Children = new[] - { - new RimHitSymbolPiece() - } - }); - - Add(new CirclePiece(true) - { - Position = new Vector2(350, 300), - AccentColour = Color4.DarkBlue, - KiaiMode = kiai, - Children = new[] - { - new RimHitSymbolPiece() - } - }); - - Add(new CirclePiece - { - Position = new Vector2(100, 500), - AccentColour = Color4.Orange, - KiaiMode = kiai, - Children = new[] - { - new SwellSymbolPiece() - } - }); - - Add(new ElongatedCirclePiece - { - Position = new Vector2(575, 100), - AccentColour = Color4.Orange, - KiaiMode = kiai, - Length = 0.10f, - PlayfieldLengthReference = () => DrawSize.X - }); - - Add(new ElongatedCirclePiece(true) - { - Position = new Vector2(575, 300), - AccentColour = Color4.Orange, - KiaiMode = kiai, - Length = 0.10f, - PlayfieldLengthReference = () => DrawSize.X - }); - } - - private void updateKiaiState() - { - foreach (var c in Children.OfType()) - c.KiaiMode = kiai; - } - - private abstract class BaseCircle : Container - { - protected readonly CirclePiece Piece; - - protected BaseCircle(CirclePiece piece) - { - Piece = piece; - - Add(Piece); - } - } - } -} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 1f4fd80ca6..515fa4347d 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -211,7 +211,6 @@ - From c2475f67215c5b93accd2f139dc78e5b21ac2725 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 14:18:54 +0930 Subject: [PATCH 13/33] Fix gravity. --- osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index de2decbda9..5a17355cdb 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -93,12 +93,13 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables Content.ScaleTo(0.8f, gravity_time * 2, Easing.OutQuad); - this.FadeOut(800) - .MoveToY(-gravity_travel_height, gravity_time, Easing.Out) + this.MoveToY(-gravity_travel_height, gravity_time, Easing.Out) .Then() .MoveToY(gravity_travel_height * 2, gravity_time * 2, Easing.In); - Expire(); + this.FadeOut(800) + .Expire(); + break; } } From dc0d0a3602a4000cc3bf1c6f2e88366469cb9d13 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 14:31:20 +0930 Subject: [PATCH 14/33] CI. --- .../Objects/Drawables/DrawableTaikoHitObject.cs | 2 -- .../Objects/Drawables/Pieces/SwellSymbolPiece.cs | 3 --- .../Objects/Drawables/Pieces/TaikoPiece.cs | 3 --- osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs | 7 +++---- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 1 - 5 files changed, 3 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 84fe36e6d9..f039f35533 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -3,14 +3,12 @@ using System.Collections.Generic; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using OpenTK; using OpenTK.Input; -using System; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs index 8e5ab14bac..d4f57f5959 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs @@ -1,10 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using OpenTK; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Game.Graphics; namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs index b942809172..4b40bbf384 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs @@ -2,12 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Graphics; -using OpenTK; using OpenTK.Graphics; using osu.Game.Graphics.Containers; using osu.Framework.Graphics; -using System; -using osu.Framework.Graphics.Containers; namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs index 5f3223e918..7e7dc3662f 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs @@ -4,24 +4,23 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Objects; -using osu.Game.Rulesets.Taiko.UI; namespace osu.Game.Rulesets.Taiko.Objects { public abstract class TaikoHitObject : HitObject { /// - /// Default size of a . + /// Default size of a drawable taiko hit object. /// public const float DEFAULT_SIZE = 0.45f; /// - /// Scale multiplier for a strong . + /// Scale multiplier for a strong drawable taiko hit object. /// public const float STRONG_SCALE = 1.4f; /// - /// Default size of a strong . + /// Default size of a strong drawable taiko hit object. /// public const float DEFAULT_STRONG_SIZE = DEFAULT_SIZE * STRONG_SCALE; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index fff19b97c9..dca339f734 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -15,7 +15,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Extensions.Color4Extensions; using System.Linq; using osu.Game.Rulesets.Taiko.Objects.Drawables; -using System; namespace osu.Game.Rulesets.Taiko.UI { From 8553e1cad30aec950729d360debedaf12e14918f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 14:38:24 +0930 Subject: [PATCH 15/33] Same default value for parameter. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 3f4d4e9722..23797f8e21 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -88,7 +88,7 @@ namespace osu.Desktop.VisualTests.Tests addDrumRoll(true); break; case 5: - addSwell(1000); + addSwell(); delay = scroll_time - 100; break; } From 09c0e18a04a63876aab159f4f7a8664c6449770f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 15:47:23 +0930 Subject: [PATCH 16/33] Fix incorrect size reset function. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 23797f8e21..717538ff89 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -100,7 +100,7 @@ namespace osu.Desktop.VisualTests.Tests playfieldContainer.Delay(delay).ResizeTo(new Vector2(1, rng.Next(25, 400)), 500); break; case 6: - playfieldContainer.Delay(delay).ResizeTo(new Vector2(TaikoPlayfield.DEFAULT_HEIGHT), 500); + playfieldContainer.Delay(delay).ResizeTo(new Vector2(1, TaikoPlayfield.DEFAULT_HEIGHT), 500); break; } } From 74e9449a7574e38f9df7d41cc12c62806f1f0aaf Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 15:57:45 +0930 Subject: [PATCH 17/33] Make symbol pieces relative sized. --- .../Drawables/Pieces/CentreHitSymbolPiece.cs | 17 ++++++++--- .../Objects/Drawables/Pieces/CirclePiece.cs | 3 +- .../Drawables/Pieces/SwellSymbolPiece.cs | 29 +++++++++++++++---- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs index 8ad548b3d6..f4c78251d0 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs @@ -11,17 +11,26 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces /// /// The symbol used for centre hit pieces. /// - public class CentreHitSymbolPiece : CircularContainer + public class CentreHitSymbolPiece : Container { public CentreHitSymbolPiece() { Anchor = Anchor.Centre; Origin = Anchor.Centre; - Size = new Vector2(CirclePiece.SYMBOL_INNER_SIZE); - Masking = true; + RelativeSizeAxes = Axes.Both; + Size = new Vector2(CirclePiece.SYMBOL_SIZE); + Padding = new MarginPadding(CirclePiece.SYMBOL_BORDER); - Children = new[] { new Box { RelativeSizeAxes = Axes.Both } }; + Children = new[] + { + new CircularContainer + { + RelativeSizeAxes = Axes.Both, + Masking = true, + Children = new[] { new Box { RelativeSizeAxes = Axes.Both } } + } + }; } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index 481f0a6fc8..541c774cca 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -22,9 +22,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces /// public class CirclePiece : TaikoPiece { - public const float SYMBOL_SIZE = 36; + public const float SYMBOL_SIZE = 0.35f; public const float SYMBOL_BORDER = 8; - public const float SYMBOL_INNER_SIZE = SYMBOL_SIZE - 2 * SYMBOL_BORDER; private const double pre_beat_transition_time = 80; /// diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs index d4f57f5959..cf16d53bb4 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs @@ -1,7 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using OpenTK; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Game.Graphics; namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces @@ -9,18 +12,34 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces /// /// The symbol used for swell pieces. /// - public class SwellSymbolPiece : TextAwesome + public class SwellSymbolPiece : Container { + private readonly TextAwesome symbol; + public SwellSymbolPiece() { Anchor = Anchor.Centre; Origin = Anchor.Centre; - TextSize = CirclePiece.SYMBOL_INNER_SIZE; + RelativeSizeAxes = Axes.Both; + Size = new Vector2(CirclePiece.SYMBOL_SIZE); + Padding = new MarginPadding(CirclePiece.SYMBOL_BORDER); - Icon = FontAwesome.fa_asterisk; - UseFullGlyphHeight = true; - Shadow = false; + Children = new[] + { + symbol = new TextAwesome + { + Icon = FontAwesome.fa_asterisk, + UseFullGlyphHeight = true, + Shadow = false + } + }; + } + + protected override void Update() + { + base.Update(); + symbol.TextSize = Math.Min(ChildSize.X, ChildSize.Y); } } } From 351d255355f3b967eaa4e11f94b0c8e76b982201 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 20:04:35 +0930 Subject: [PATCH 18/33] Fix brokenness due to relative sizes. --- .../Objects/Drawables/Pieces/CirclePiece.cs | 8 +------- .../Objects/Drawables/Pieces/RimHitSymbolPiece.cs | 1 + .../Objects/Drawables/Pieces/SwellSymbolPiece.cs | 1 - .../Objects/Drawables/Pieces/TickPiece.cs | 5 +++-- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index 541c774cca..c4746a664b 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces /// public class CirclePiece : TaikoPiece { - public const float SYMBOL_SIZE = 0.35f; + public const float SYMBOL_SIZE = 0.45f; public const float SYMBOL_BORDER = 8; private const double pre_beat_transition_time = 80; @@ -126,12 +126,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces RelativeSizeAxes = Axes.Both, } }); - - if (isStrong) - { - content.Scale = new Vector2(TaikoHitObject.STRONG_SCALE); - content.Width = 1 / TaikoHitObject.STRONG_SCALE; - } } private const float edge_alpha_kiai = 0.5f; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs index 9745b6b42d..60224a291d 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs @@ -19,6 +19,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces Anchor = Anchor.Centre; Origin = Anchor.Centre; + RelativeSizeAxes = Axes.Both; Size = new Vector2(CirclePiece.SYMBOL_SIZE); BorderThickness = CirclePiece.SYMBOL_BORDER; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs index c1ab759e2b..ac10743539 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs @@ -6,7 +6,6 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; -using OpenTK; namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs index 5f864bc554..211bf910a4 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs @@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces /// /// The size of a tick. /// - private const float tick_size = 14; + private const float tick_size = 0.35f; private bool filled; public bool Filled @@ -40,7 +40,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces Anchor = Anchor.Centre; Origin = Anchor.Centre; - RelativeSizeAxes = Axes.None; + RelativeSizeAxes = Axes.Both; + FillMode = FillMode.Fit; Size = new Vector2(tick_size); Add(new CircularContainer From ba31bfcdf12a76a085aaf015d62c8c9565a2a367 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 3 Aug 2017 20:19:50 +0930 Subject: [PATCH 19/33] CI fixes. --- osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs | 2 +- osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs | 3 --- .../Objects/Drawables/DrawableTaikoHitObject.cs | 2 +- .../Objects/Drawables/Pieces/CirclePiece.cs | 3 +-- .../Objects/Drawables/Pieces/ElongatedCirclePiece.cs | 3 +-- .../Objects/Drawables/Pieces/SwellSymbolPiece.cs | 1 - 6 files changed, 4 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs index 756eff6fdf..74f0f2326d 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override TaikoJudgement CreateJudgement() => new TaikoJudgement { SecondHit = HitObject.IsStrong }; - protected override TaikoPiece CreateMainPiece() => new ElongatedCirclePiece(HitObject.IsStrong) + protected override TaikoPiece CreateMainPiece() => new ElongatedCirclePiece { Length = (float)(HitObject.Duration / HitObject.ScrollTime), PlayfieldLengthReference = () => Parent.DrawSize.X diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs index 1c6b12ea43..57e7eea470 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs @@ -7,7 +7,6 @@ using osu.Framework.Input; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Taiko.Judgements; using OpenTK.Input; -using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { @@ -28,8 +27,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { } - protected override TaikoPiece CreateMainPiece() => new CirclePiece(true); - protected override TaikoJudgement CreateJudgement() => new TaikoStrongHitJudgement(); protected override void CheckJudgement(bool userTriggered) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index f039f35533..510994ed70 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override TaikoJudgement CreateJudgement() => new TaikoJudgement(); - protected virtual TaikoPiece CreateMainPiece() => new CirclePiece(HitObject.IsStrong); + protected virtual TaikoPiece CreateMainPiece() => new CirclePiece(); /// /// Sets the scroll position of the DrawableHitObject relative to the offset between diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index c4746a664b..ba717371dd 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -9,7 +9,6 @@ using osu.Game.Graphics.Backgrounds; using OpenTK.Graphics; using osu.Game.Beatmaps.ControlPoints; using osu.Framework.Audio.Track; -using OpenTK; namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { @@ -64,7 +63,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces public Box FlashBox; - public CirclePiece(bool isStrong = false) + public CirclePiece() { EarlyActivationMilliseconds = pre_beat_transition_time; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs index ce591335f8..2f5b4eefd6 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs @@ -18,8 +18,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces /// public float Length; - public ElongatedCirclePiece(bool isStrong = false) - : base(isStrong) + public ElongatedCirclePiece() { RelativeSizeAxes = Axes.Y; } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs index ac10743539..c3fdc671a4 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; From 8843d978957f486e5069c955f4d58f37005d9b05 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Sat, 5 Aug 2017 18:01:10 +0800 Subject: [PATCH 20/33] Remove depth setting in SectionsContainer and profile. --- osu.Game/Graphics/Containers/SectionsContainer.cs | 6 ++---- osu.Game/Overlays/UserProfileOverlay.cs | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 6dadf0b0b0..6e5c3c8183 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -128,13 +128,11 @@ namespace osu.Game.Graphics.Containers RelativeSizeAxes = Axes.Both, Masking = true, ScrollbarVisible = false, - Children = new Drawable[] { scrollContentContainer = CreateScrollContentContainer() }, - Depth = float.MaxValue + Children = new Drawable[] { scrollContentContainer = CreateScrollContentContainer() } }); AddInternal(headerBackgroundContainer = new Container { - RelativeSizeAxes = Axes.X, - Depth = float.MaxValue / 2 + RelativeSizeAxes = Axes.X }); originalSectionsMargin = scrollContentContainer.Margin; } diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index f604eb5cd2..f03ef3f1ed 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -169,13 +169,11 @@ namespace osu.Game.Overlays { header.User = user; - for (int i = 0; i < user.ProfileOrder.Length; i++) + foreach (string id in user.ProfileOrder) { - string id = user.ProfileOrder[i]; var sec = sections.FirstOrDefault(s => s.Identifier == id); if (sec != null) { - sec.Depth = -i; sectionsContainer.Add(sec); tabs.AddItem(sec); } From d7fede96ef98c1139960c5e15e9bb885e0a039ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 5 Aug 2017 11:09:34 +0900 Subject: [PATCH 21/33] Fix shadow on SpriteIcon being a bit off --- osu.Game/Graphics/SpriteIcon.cs | 46 +++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index 345c6e7639..4bf4af922a 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -18,18 +19,19 @@ namespace osu.Game.Graphics public SpriteIcon() { + spriteShadow = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + Depth = 2, + Y = 2, + Colour = new Color4(0f, 0f, 0f, 0.2f), + }; + InternalChildren = new[] { - spriteShadow = new Sprite - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fit, - Position = new Vector2(0, 0.06f), - Colour = new Color4(0f, 0f, 0f, 0.2f), - Alpha = 0 - }, spriteMain = new Sprite { Anchor = Anchor.Centre, @@ -60,10 +62,32 @@ namespace osu.Game.Graphics Size = new Vector2(texture?.DisplayWidth ?? 0, texture?.DisplayHeight ?? 0); } + public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) + { + if ((invalidation & Invalidation.Colour) > 0) + { + //adjust shadow alpha based on highest component intensity to avoid muddy display of darker text. + //squared result for quadratic fall-off seems to give the best result. + var avgColour = (Color4)DrawInfo.Colour.AverageColour; + + spriteShadow.Alpha = (float)Math.Pow(Math.Max(Math.Max(avgColour.R, avgColour.G), avgColour.B), 2); + } + + return base.Invalidate(invalidation, source, shallPropagate); + } + public bool Shadow { get { return spriteShadow.IsPresent; } - set { spriteShadow.Alpha = value ? 1 : 0; } + set + { + if (value == (spriteShadow.IsAlive && spriteShadow.IsLoaded)) return; + + if (value) + AddInternal(spriteShadow); + else + RemoveInternal(spriteShadow); + } } private FontAwesome icon; From 3416925233038007eb5914ac15c38855740eaad3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 5 Aug 2017 11:09:44 +0900 Subject: [PATCH 22/33] Fix alignment of icons on mod buttons --- osu.Game/Rulesets/UI/ModIcon.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 03705c19e6..986d8c92dc 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -45,10 +45,11 @@ namespace osu.Game.Rulesets.UI }, modIcon = new SpriteIcon { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, Colour = OsuColour.Gray(84), Size = new Vector2(icon_size - 35), + Y = 25, Icon = mod.Icon }, }; From 224de9cc1ea9d911b1718f200ae5b3c4b8b10ec5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 5 Aug 2017 11:59:58 +0900 Subject: [PATCH 23/33] Implement NoFail mod --- osu.Game/Rulesets/Mods/Mod.cs | 5 +++++ osu.Game/Rulesets/Mods/ModNoFail.cs | 5 +++++ osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 7 ++++--- osu.Game/Screens/Play/Player.cs | 6 +++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Mods/Mod.cs b/osu.Game/Rulesets/Mods/Mod.cs index c00847b7d8..69daedb7a7 100644 --- a/osu.Game/Rulesets/Mods/Mod.cs +++ b/osu.Game/Rulesets/Mods/Mod.cs @@ -45,5 +45,10 @@ namespace osu.Game.Rulesets.Mods /// The mods this mod cannot be enabled with. /// public virtual Type[] IncompatibleMods => new Type[] { }; + + /// + /// Whether we should allow fails at the + /// + public virtual bool AllowFail => true; } } diff --git a/osu.Game/Rulesets/Mods/ModNoFail.cs b/osu.Game/Rulesets/Mods/ModNoFail.cs index 613e1e1d4d..d41c4e3956 100644 --- a/osu.Game/Rulesets/Mods/ModNoFail.cs +++ b/osu.Game/Rulesets/Mods/ModNoFail.cs @@ -15,5 +15,10 @@ namespace osu.Game.Rulesets.Mods public override double ScoreMultiplier => 0.5; public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModAutoplay) }; + + /// + /// We never fail, 'yo. + /// + public override bool AllowFail => false; } } \ No newline at end of file diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 79fb34a523..cd9089c859 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -16,8 +16,9 @@ namespace osu.Game.Rulesets.Scoring { /// /// Invoked when the ScoreProcessor is in a failed state. + /// Return true if the fail was permitted. /// - public event Action Failed; + public event Func Failed; /// /// Invoked when a new judgement has occurred. This occurs after the judgement has been processed by the . @@ -106,8 +107,8 @@ namespace osu.Game.Rulesets.Scoring if (alreadyFailed || !HasFailed) return; - alreadyFailed = true; - Failed?.Invoke(); + if (Failed?.Invoke() != false) + alreadyFailed = true; } /// diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 39128eb85e..345ad60d47 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -238,13 +238,17 @@ namespace osu.Game.Screens.Play } } - private void onFail() + private bool onFail() { + if (Beatmap.Value.Mods.Value.Any(m => !m.AllowFail)) + return false; + decoupledClock.Stop(); HasFailed = true; failOverlay.Retries = RestartCount; failOverlay.Show(); + return true; } protected override void OnEntering(Screen last) From e75f438c29370ff1d618b2691559ea240d060201 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 5 Aug 2017 16:22:10 +0900 Subject: [PATCH 24/33] Add difficulty application mods Also fixes circular references when using IJsonSerializable. --- osu.Game/Beatmaps/Beatmap.cs | 3 ++- osu.Game/Beatmaps/WorkingBeatmap.cs | 9 +++++++- .../IO/Serialization/IJsonSerializable.cs | 2 +- .../Rulesets/Mods/IApplicableToDifficulty.cs | 15 +++++++++++++ osu.Game/Rulesets/Mods/ModEasy.cs | 12 +++++++++- osu.Game/Rulesets/Mods/ModHardRock.cs | 12 +++++++++- osu.Game/Rulesets/UI/HitRenderer.cs | 6 ++++- osu.Game/Screens/Play/Player.cs | 22 ++++++++++++------- osu.Game/osu.Game.csproj | 1 + 9 files changed, 68 insertions(+), 14 deletions(-) create mode 100644 osu.Game/Rulesets/Mods/IApplicableToDifficulty.cs diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 8668b0c995..82777734bb 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -7,6 +7,7 @@ using osu.Game.Rulesets.Objects; using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.IO.Serialization; namespace osu.Game.Beatmaps { @@ -45,7 +46,7 @@ namespace osu.Game.Beatmaps /// The original beatmap to use the parameters of. public Beatmap(Beatmap original = null) { - BeatmapInfo = original?.BeatmapInfo ?? BeatmapInfo; + BeatmapInfo = original?.BeatmapInfo.DeepClone() ?? BeatmapInfo; ControlPointInfo = original?.ControlPointInfo ?? ControlPointInfo; Breaks = original?.Breaks ?? Breaks; ComboColors = original?.ComboColors ?? ComboColors; diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index a6a3b23d5d..462f94ed7c 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -52,7 +52,14 @@ namespace osu.Game.Beatmaps { lock (beatmapLock) { - return beatmap ?? (beatmap = GetBeatmap()); + if (beatmap != null) return beatmap; + + beatmap = GetBeatmap(); + + // use the database-backed info. + beatmap.BeatmapInfo = BeatmapInfo; + + return beatmap; } } } diff --git a/osu.Game/IO/Serialization/IJsonSerializable.cs b/osu.Game/IO/Serialization/IJsonSerializable.cs index 7dbc860979..e725742726 100644 --- a/osu.Game/IO/Serialization/IJsonSerializable.cs +++ b/osu.Game/IO/Serialization/IJsonSerializable.cs @@ -13,7 +13,7 @@ namespace osu.Game.IO.Serialization { public static string Serialize(this IJsonSerializable obj) { - return JsonConvert.SerializeObject(obj); + return JsonConvert.SerializeObject(obj, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); } public static T Deserialize(this string objString) diff --git a/osu.Game/Rulesets/Mods/IApplicableToDifficulty.cs b/osu.Game/Rulesets/Mods/IApplicableToDifficulty.cs new file mode 100644 index 0000000000..58f5defb5e --- /dev/null +++ b/osu.Game/Rulesets/Mods/IApplicableToDifficulty.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Beatmaps; + +namespace osu.Game.Rulesets.Mods +{ + /// + /// An interface for mods that make general adjustments to difficulty. + /// + public interface IApplicableToDifficulty + { + void ApplyToDifficulty(BeatmapDifficulty difficulty); + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModEasy.cs b/osu.Game/Rulesets/Mods/ModEasy.cs index 8eef9c70d6..075a62b0d7 100644 --- a/osu.Game/Rulesets/Mods/ModEasy.cs +++ b/osu.Game/Rulesets/Mods/ModEasy.cs @@ -2,11 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using osu.Game.Beatmaps; using osu.Game.Graphics; namespace osu.Game.Rulesets.Mods { - public abstract class ModEasy : Mod + public abstract class ModEasy : Mod, IApplicableToDifficulty { public override string Name => "Easy"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_easy; @@ -15,5 +16,14 @@ namespace osu.Game.Rulesets.Mods public override double ScoreMultiplier => 0.5; public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) }; + + public void ApplyToDifficulty(BeatmapDifficulty difficulty) + { + const float ratio = 0.5f; + difficulty.CircleSize *= ratio; + difficulty.ApproachRate *= ratio; + difficulty.DrainRate *= ratio; + difficulty.OverallDifficulty *= ratio; + } } } \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModHardRock.cs b/osu.Game/Rulesets/Mods/ModHardRock.cs index 2516c02526..fe1529d0dc 100644 --- a/osu.Game/Rulesets/Mods/ModHardRock.cs +++ b/osu.Game/Rulesets/Mods/ModHardRock.cs @@ -2,16 +2,26 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using osu.Game.Beatmaps; using osu.Game.Graphics; namespace osu.Game.Rulesets.Mods { - public abstract class ModHardRock : Mod + public abstract class ModHardRock : Mod, IApplicableToDifficulty { public override string Name => "Hard Rock"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock; public override ModType Type => ModType.DifficultyIncrease; public override string Description => "Everything just got a bit harder..."; public override Type[] IncompatibleMods => new[] { typeof(ModEasy) }; + + public void ApplyToDifficulty(BeatmapDifficulty difficulty) + { + const float ratio = 1.4f; + difficulty.CircleSize *= ratio; + difficulty.ApproachRate *= ratio; + difficulty.DrainRate *= ratio; + difficulty.OverallDifficulty *= ratio; + } } } \ No newline at end of file diff --git a/osu.Game/Rulesets/UI/HitRenderer.cs b/osu.Game/Rulesets/UI/HitRenderer.cs index 8fe1dd3e0a..2ce868b22e 100644 --- a/osu.Game/Rulesets/UI/HitRenderer.cs +++ b/osu.Game/Rulesets/UI/HitRenderer.cs @@ -153,6 +153,10 @@ namespace osu.Game.Rulesets.UI // Convert the beatmap Beatmap = converter.Convert(beatmap.Beatmap, isForCurrentRuleset); + // Apply difficulty adjustments from mods before using Difficulty. + foreach (var mod in Mods.OfType()) + mod.ApplyToDifficulty(Beatmap.BeatmapInfo.Difficulty); + // Apply defaults foreach (var h in Beatmap.HitObjects) h.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.Difficulty); @@ -163,7 +167,7 @@ namespace osu.Game.Rulesets.UI ApplyBeatmap(); // Add mods, should always be the last thing applied to give full control to mods - applyMods(beatmap.Mods.Value); + applyMods(Mods); } /// diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 345ad60d47..a13e9ed369 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -22,6 +22,7 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Ranking; using osu.Framework.Audio.Sample; +using osu.Game.Beatmaps; namespace osu.Game.Screens.Play { @@ -77,23 +78,28 @@ namespace osu.Game.Screens.Play Ruleset rulesetInstance; + WorkingBeatmap working = Beatmap.Value; + Beatmap beatmap; + try { - if (Beatmap.Value.Beatmap == null) + beatmap = working.Beatmap; + + if (beatmap == null) throw new InvalidOperationException("Beatmap was not loaded"); - ruleset = osu?.Ruleset.Value ?? Beatmap.Value.BeatmapInfo.Ruleset; + ruleset = osu?.Ruleset.Value ?? beatmap.BeatmapInfo.Ruleset; rulesetInstance = ruleset.CreateInstance(); try { - HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap, ruleset.ID == Beatmap.Value.BeatmapInfo.Ruleset.ID); + HitRenderer = rulesetInstance.CreateHitRendererWith(working, ruleset.ID == beatmap.BeatmapInfo.Ruleset.ID); } catch (BeatmapInvalidForRulesetException) { // we may fail to create a HitRenderer if the beatmap cannot be loaded with the user's preferred ruleset // let's try again forcing the beatmap's ruleset. - ruleset = Beatmap.Value.BeatmapInfo.Ruleset; + ruleset = beatmap.BeatmapInfo.Ruleset; rulesetInstance = ruleset.CreateInstance(); HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap, true); } @@ -110,11 +116,11 @@ namespace osu.Game.Screens.Play return; } - adjustableSourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock(); + adjustableSourceClock = (IAdjustableClock)working.Track ?? new StopwatchClock(); decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; var firstObjectTime = HitRenderer.Objects.First().StartTime; - decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, Beatmap.Value.BeatmapInfo.AudioLeadIn))); + decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, beatmap.BeatmapInfo.AudioLeadIn))); decoupledClock.ProcessFrame(); offsetClock = new FramedOffsetClock(decoupledClock); @@ -127,7 +133,7 @@ namespace osu.Game.Screens.Play { adjustableSourceClock.Reset(); - foreach (var mod in Beatmap.Value.Mods.Value.OfType()) + foreach (var mod in working.Mods.Value.OfType()) mod.ApplyToClock(adjustableSourceClock); decoupledClock.ChangeSource(adjustableSourceClock); @@ -195,7 +201,7 @@ namespace osu.Game.Screens.Play hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded; hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos); - hudOverlay.ModDisplay.Current.BindTo(Beatmap.Value.Mods); + hudOverlay.ModDisplay.Current.BindTo(working.Mods); //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) HitRenderer.OnAllJudged += onCompletion; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 3f475a34c8..d07203aa25 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -117,6 +117,7 @@ + From 6f93aa6131838cc9f64ca79be6195ffe4828a374 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 7 Aug 2017 09:01:47 +0900 Subject: [PATCH 25/33] Fix incomplete comment --- osu.Game/Rulesets/Mods/Mod.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Mods/Mod.cs b/osu.Game/Rulesets/Mods/Mod.cs index 69daedb7a7..f54267af29 100644 --- a/osu.Game/Rulesets/Mods/Mod.cs +++ b/osu.Game/Rulesets/Mods/Mod.cs @@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Mods public virtual Type[] IncompatibleMods => new Type[] { }; /// - /// Whether we should allow fails at the + /// Whether we should allow failing at the current point in time. /// public virtual bool AllowFail => true; } From de3b65e1fa43b6b1a7791b61cb447686a4cdf8e7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 7 Aug 2017 09:45:44 +0900 Subject: [PATCH 26/33] Fix StoredBookmarks not being serialized --- osu.Game/Beatmaps/BeatmapInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 6f4a4a8a69..ec90cabf02 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -69,7 +69,7 @@ namespace osu.Game.Beatmaps // Editor // This bookmarks stuff is necessary because DB doesn't know how to store int[] - public string StoredBookmarks { get; internal set; } + public string StoredBookmarks { get; set; } [Ignore] [JsonIgnore] From 8941c8658cf50f7e505a9c6bb4d559af30932f20 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 7 Aug 2017 09:50:04 +0900 Subject: [PATCH 27/33] Use nested containers for shadow --- osu.Game/Graphics/SpriteIcon.cs | 38 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index 4bf4af922a..93c85d67cb 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -17,21 +17,28 @@ namespace osu.Game.Graphics private readonly Sprite spriteShadow; private readonly Sprite spriteMain; + private readonly Container shadowVisibility; + public SpriteIcon() { - spriteShadow = new Sprite - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fit, - Depth = 2, - Y = 2, - Colour = new Color4(0f, 0f, 0f, 0.2f), - }; - - InternalChildren = new[] + InternalChildren = new Drawable[] { + shadowVisibility = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Child = spriteShadow = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + Y = 2, + Colour = new Color4(0f, 0f, 0f, 0.2f), + }, + Alpha = 0, + }, spriteMain = new Sprite { Anchor = Anchor.Centre, @@ -81,12 +88,7 @@ namespace osu.Game.Graphics get { return spriteShadow.IsPresent; } set { - if (value == (spriteShadow.IsAlive && spriteShadow.IsLoaded)) return; - - if (value) - AddInternal(spriteShadow); - else - RemoveInternal(spriteShadow); + shadowVisibility.Alpha = value ? 1 : 0; } } From da84f1ce39b2e74cd2dc1b5475c81a085572e40a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 7 Aug 2017 09:56:50 +0900 Subject: [PATCH 28/33] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 9ae8979ef7..107c551767 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 9ae8979ef7ef0968c90cdbce40a04969d43633c7 +Subproject commit 107c5517670ca88dbe8c83a97e37e99ac5742ee6 From eb190d83bd98b9ea07967ed9fd043d5330dd98f2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 7 Aug 2017 10:43:33 +0900 Subject: [PATCH 29/33] Adjust CS multiplier to match stable --- osu.Game/Rulesets/Mods/ModHardRock.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Mods/ModHardRock.cs b/osu.Game/Rulesets/Mods/ModHardRock.cs index fe1529d0dc..f33f46a207 100644 --- a/osu.Game/Rulesets/Mods/ModHardRock.cs +++ b/osu.Game/Rulesets/Mods/ModHardRock.cs @@ -18,10 +18,10 @@ namespace osu.Game.Rulesets.Mods public void ApplyToDifficulty(BeatmapDifficulty difficulty) { const float ratio = 1.4f; - difficulty.CircleSize *= ratio; + difficulty.CircleSize *= 1.3f; // CS uses a custom 1.3 ratio. difficulty.ApproachRate *= ratio; difficulty.DrainRate *= ratio; difficulty.OverallDifficulty *= ratio; } } -} \ No newline at end of file +} From 953cf5af58f69f27974c357b69bd345167e61e9e Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 7 Aug 2017 13:26:45 +0900 Subject: [PATCH 30/33] Fix SpriteIcon invalidation causing game breakness. --- osu.Game/Graphics/SpriteIcon.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index 93c85d67cb..30125330c8 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.IO.Stores; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Caching; namespace osu.Game.Graphics { @@ -17,6 +18,7 @@ namespace osu.Game.Graphics private readonly Sprite spriteShadow; private readonly Sprite spriteMain; + private readonly Cached layout = new Cached(); private readonly Container shadowVisibility; public SpriteIcon() @@ -71,16 +73,23 @@ namespace osu.Game.Graphics public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if ((invalidation & Invalidation.Colour) > 0) + if ((invalidation & Invalidation.Colour) > 0 && Shadow) + layout.Invalidate(); + return base.Invalidate(invalidation, source, shallPropagate); + } + + protected override void Update() + { + if (!layout.IsValid) { //adjust shadow alpha based on highest component intensity to avoid muddy display of darker text. //squared result for quadratic fall-off seems to give the best result. var avgColour = (Color4)DrawInfo.Colour.AverageColour; spriteShadow.Alpha = (float)Math.Pow(Math.Max(Math.Max(avgColour.R, avgColour.G), avgColour.B), 2); - } - return base.Invalidate(invalidation, source, shallPropagate); + layout.Validate(); + } } public bool Shadow From ce7d391f06f9d52762f931b4d05e34bf4828bd20 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 7 Aug 2017 13:37:07 +0900 Subject: [PATCH 31/33] These method calls are impure. --- osu.Game/Graphics/SpriteIcon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index 30125330c8..d49814952c 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -18,7 +18,7 @@ namespace osu.Game.Graphics private readonly Sprite spriteShadow; private readonly Sprite spriteMain; - private readonly Cached layout = new Cached(); + private Cached layout = new Cached(); private readonly Container shadowVisibility; public SpriteIcon() From 2221797273d704a2d562467790ba4b251397a1a6 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 7 Aug 2017 14:09:49 +0900 Subject: [PATCH 32/33] Add transform sequence support to IHasAccentColour. --- osu.Game/Graphics/IHasAccentColour.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game/Graphics/IHasAccentColour.cs b/osu.Game/Graphics/IHasAccentColour.cs index ac2117c517..ca712af890 100644 --- a/osu.Game/Graphics/IHasAccentColour.cs +++ b/osu.Game/Graphics/IHasAccentColour.cs @@ -29,5 +29,16 @@ namespace osu.Game.Graphics public static TransformSequence FadeAccent(this T accentedDrawable, Color4 newColour, double duration = 0, Easing easing = Easing.None) where T : IHasAccentColour => accentedDrawable.TransformTo(nameof(accentedDrawable.AccentColour), newColour, duration, easing); + + /// + /// Tweens the accent colour of a drawable to another colour. + /// + /// The drawable to apply the accent colour to. + /// The new accent colour. + /// The tween duration. + /// The tween easing. + public static TransformSequence FadeAccent(this TransformSequence t, Color4 newColour, double duration = 0, Easing easing = Easing.None) + where T : Drawable, IHasAccentColour + => t.Append(o => o.FadeAccent(newColour, duration, easing)); } } From d0906d8232a3a0048a2e2630b44f7a7df05dfdb0 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 7 Aug 2017 14:20:18 +0900 Subject: [PATCH 33/33] Adjust xmldocs to conform to TransformableExtensions. --- osu.Game/Graphics/IHasAccentColour.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/osu.Game/Graphics/IHasAccentColour.cs b/osu.Game/Graphics/IHasAccentColour.cs index ca712af890..0c6bf98db4 100644 --- a/osu.Game/Graphics/IHasAccentColour.cs +++ b/osu.Game/Graphics/IHasAccentColour.cs @@ -20,23 +20,17 @@ namespace osu.Game.Graphics public static class AccentedColourExtensions { /// - /// Tweens the accent colour of a drawable to another colour. + /// Smoothly adjusts over time. /// - /// The drawable to apply the accent colour to. - /// The new accent colour. - /// The tween duration. - /// The tween easing. + /// A to which further transforms can be added. public static TransformSequence FadeAccent(this T accentedDrawable, Color4 newColour, double duration = 0, Easing easing = Easing.None) where T : IHasAccentColour => accentedDrawable.TransformTo(nameof(accentedDrawable.AccentColour), newColour, duration, easing); /// - /// Tweens the accent colour of a drawable to another colour. + /// Smoothly adjusts over time. /// - /// The drawable to apply the accent colour to. - /// The new accent colour. - /// The tween duration. - /// The tween easing. + /// A to which further transforms can be added. public static TransformSequence FadeAccent(this TransformSequence t, Color4 newColour, double duration = 0, Easing easing = Easing.None) where T : Drawable, IHasAccentColour => t.Append(o => o.FadeAccent(newColour, duration, easing));