From d6bf5c38b741cff04871533f245b9a3121097ac2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 12 Sep 2017 10:01:07 +0900 Subject: [PATCH 1/5] Move Kiai bool to HitObject. --- .../Objects/TaikoHitObject.cs | 16 +--------------- osu.Game/Rulesets/Objects/HitObject.cs | 8 ++++++++ 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs index f1c0afc675..a62e0260bd 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs @@ -29,19 +29,5 @@ namespace osu.Game.Rulesets.Taiko.Objects /// Strong hit objects give more points for hitting the hit object with both keys. /// public bool IsStrong; - - /// - /// Whether this HitObject is in Kiai time. - /// - public bool Kiai { get; protected set; } - - public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) - { - base.ApplyDefaults(controlPointInfo, difficulty); - - EffectControlPoint effectPoint = controlPointInfo.EffectPointAt(StartTime); - - Kiai |= effectPoint.KiaiMode; - } } -} \ No newline at end of file +} diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index c343cdaf33..c69979d4cf 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -30,6 +30,11 @@ namespace osu.Game.Rulesets.Objects /// public SampleInfoList Samples = new SampleInfoList(); + /// + /// Whether this is in Kiai time. + /// + public bool Kiai { get; private set; } + /// /// Applies default values to this HitObject. /// @@ -38,6 +43,9 @@ namespace osu.Game.Rulesets.Objects public virtual void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) { SoundControlPoint soundPoint = controlPointInfo.SoundPointAt(StartTime); + EffectControlPoint effectPoint = controlPointInfo.EffectPointAt(StartTime); + + Kiai |= effectPoint.KiaiMode; // Initialize first sample Samples.ForEach(s => initializeSampleInfo(s, soundPoint)); From 0765027cb551bbed8c8c053b43373b9bd3c78a4d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 12 Sep 2017 11:14:16 +0900 Subject: [PATCH 2/5] Move note glow to a separate class + make it match the design a bit more. --- .../Objects/Drawables/DrawableHoldNote.cs | 57 +++++------------ .../Objects/Drawables/DrawableNote.cs | 47 +++----------- .../Objects/Drawables/Pieces/GlowPiece.cs | 62 +++++++++++++++++++ .../osu.Game.Rulesets.Mania.csproj | 1 + 4 files changed, 87 insertions(+), 80 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index 3b801cba01..b0e2f4e3da 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Extensions.Color4Extensions; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Graphics; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; @@ -10,7 +9,6 @@ using OpenTK; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Mania.Judgements; using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Bindings; namespace osu.Game.Rulesets.Mania.Objects.Drawables @@ -23,9 +21,10 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables private readonly DrawableNote head; private readonly DrawableNote tail; + private readonly GlowPiece glowPiece; private readonly BodyPiece bodyPiece; private readonly Container tickContainer; - private readonly Container glowContainer; + private readonly Container fullHeightContainer; /// /// Time at which the user started holding this hold note. Null if the user is not holding this hold note. @@ -45,6 +44,13 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables AddRange(new Drawable[] { + // The hit object itself cannot be used for various elements because the tail overshoots it + // So a specialized container that is updated to contain the tail height is used + fullHeightContainer = new Container + { + RelativeSizeAxes = Axes.X, + Child = glowPiece = new GlowPiece() + }, bodyPiece = new BodyPiece { Anchor = Anchor.TopCentre, @@ -66,19 +72,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables { Anchor = Anchor.BottomCentre, Origin = Anchor.TopCentre - }, - // The hit object itself cannot be used for the glow because the tail overshoots it - // So a specialized container that is updated to contain the tail height is used - glowContainer = new Container - { - RelativeSizeAxes = Axes.X, - Masking = true, - Child = new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true - } } }); @@ -97,13 +90,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables AddNested(tail); } - protected override void LoadComplete() - { - base.LoadComplete(); - - updateGlow(); - } - public override Color4 AccentColour { get { return base.AccentColour; } @@ -115,28 +101,13 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables tickContainer.Children.ForEach(t => t.AccentColour = value); + glowPiece.AccentColour = value; bodyPiece.AccentColour = value; head.AccentColour = value; tail.AccentColour = value; - - updateGlow(); } } - private void updateGlow() - { - if (!IsLoaded) - return; - - glowContainer.EdgeEffect = new EdgeEffectParameters - { - Type = EdgeEffectType.Glow, - Colour = AccentColour.Opacity(0.5f), - Radius = 10, - Hollow = true - }; - } - protected override void UpdateState(ArmedState state) { } @@ -149,9 +120,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables bodyPiece.Y = head.Height; bodyPiece.Height = DrawHeight - head.Height; - // Make the glowContainer "contain" the height of the tail note, keeping in mind + // Make the fullHeightContainer "contain" the height of the tail note, keeping in mind // that the tail note overshoots the height of this hit object - glowContainer.Height = DrawHeight + tail.Height; + fullHeightContainer.Height = DrawHeight + tail.Height; } public bool OnPressed(ManiaAction action) @@ -208,7 +179,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables LifetimeStart = double.MinValue; LifetimeEnd = double.MaxValue; - ApplyGlow = false; + GlowPiece.Alpha = 0; } public override bool OnPressed(ManiaAction action) @@ -251,7 +222,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables LifetimeStart = double.MinValue; LifetimeEnd = double.MaxValue; - ApplyGlow = false; + GlowPiece.Alpha = 0; } protected override ManiaJudgement CreateJudgement() => new HoldNoteTailJudgement(); diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index 37d7566e43..7a2fb71fef 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs @@ -2,10 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Framework.Extensions.Color4Extensions; using OpenTK.Graphics; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Input.Bindings; using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; @@ -18,10 +16,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables /// public class DrawableNote : DrawableManiaHitObject, IKeyBindingHandler { - /// - /// Gets or sets whether this should apply glow to itself. - /// - protected bool ApplyGlow = true; + protected readonly GlowPiece GlowPiece; private readonly NotePiece headPiece; @@ -31,19 +26,15 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - Add(headPiece = new NotePiece + Children = new Drawable[] { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Masking = true - }); - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - updateGlow(); + GlowPiece = new GlowPiece(), + headPiece = new NotePiece + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre + } + }; } public override Color4 AccentColour @@ -55,29 +46,11 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables return; base.AccentColour = value; + GlowPiece.AccentColour = value; headPiece.AccentColour = value; - - updateGlow(); } } - private void updateGlow() - { - if (!IsLoaded) - return; - - if (!ApplyGlow) - return; - - headPiece.EdgeEffect = new EdgeEffectParameters - { - Type = EdgeEffectType.Glow, - Colour = AccentColour.Opacity(0.5f), - Radius = 10, - Hollow = true - }; - } - protected override void CheckJudgement(bool userTriggered) { if (!userTriggered) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs new file mode 100644 index 0000000000..b08247b180 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs @@ -0,0 +1,62 @@ +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using OpenTK.Graphics; + +namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces +{ + public class GlowPiece : CompositeDrawable, IHasAccentColour + { + private const float glow_alpha = 0.7f; + private const float glow_radius = 5; + + public GlowPiece() + { + RelativeSizeAxes = Axes.Both; + Masking = true; + + InternalChild = new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + updateGlow(); + } + + private Color4 accentColour; + public Color4 AccentColour + { + get { return accentColour; } + set + { + if (accentColour == value) + return; + accentColour = value; + + updateGlow(); + } + } + + private void updateGlow() + { + if (!IsLoaded) + return; + + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Glow, + Colour = AccentColour.Opacity(glow_alpha), + Radius = glow_radius, + Hollow = true + }; + } + } +} diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index ef098a023d..3161ae8d7f 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -70,6 +70,7 @@ + From 57ee97e27d499de49216b988be78045c5919130a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 12 Sep 2017 11:14:29 +0900 Subject: [PATCH 3/5] Add lane glows. --- .../Objects/Drawables/DrawableNote.cs | 7 ++ .../Objects/Drawables/Pieces/LaneGlowPiece.cs | 82 +++++++++++++++++++ .../osu.Game.Rulesets.Mania.csproj | 1 + 3 files changed, 90 insertions(+) create mode 100644 osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/LaneGlowPiece.cs diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index 7a2fb71fef..ff2d4e8817 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs @@ -18,6 +18,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables { protected readonly GlowPiece GlowPiece; + private readonly LaneGlowPiece laneGlowPiece; private readonly NotePiece headPiece; public DrawableNote(Note hitObject, ManiaAction action) @@ -28,6 +29,11 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables Children = new Drawable[] { + laneGlowPiece = new LaneGlowPiece + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }, GlowPiece = new GlowPiece(), headPiece = new NotePiece { @@ -46,6 +52,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables return; base.AccentColour = value; + laneGlowPiece.AccentColour = value; GlowPiece.AccentColour = value; headPiece.AccentColour = value; } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/LaneGlowPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/LaneGlowPiece.cs new file mode 100644 index 0000000000..38652d50af --- /dev/null +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/LaneGlowPiece.cs @@ -0,0 +1,82 @@ +using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; + +namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces +{ + public class LaneGlowPiece : CompositeDrawable, IHasAccentColour + { + private const float total_height = 100; + private const float glow_height = 50; + private const float glow_alpha = 0.4f; + private const float edge_alpha = 0.3f; + + public LaneGlowPiece() + { + BypassAutoSizeAxes = Axes.Both; + RelativeSizeAxes = Axes.X; + Height = total_height; + + InternalChildren = new[] + { + new Container + { + Name = "Left edge", + RelativeSizeAxes = Axes.Y, + Width = 1, + Children = createGradient(edge_alpha) + }, + new Container + { + Name = "Right edge", + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + RelativeSizeAxes = Axes.Y, + Width = 1, + Children = createGradient(edge_alpha) + }, + new Container + { + Name = "Glow", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + Height = glow_height, + Children = createGradient(glow_alpha) + } + }; + } + + private Drawable[] createGradient(float alpha) => new Drawable[] + { + new Box + { + Name = "Top", + RelativeSizeAxes = Axes.Both, + Height = 0.5f, + Blending = BlendingMode.Additive, + Colour = ColourInfo.GradientVertical(Color4.Transparent, Color4.White.Opacity(alpha)) + }, + new Box + { + Name = "Bottom", + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.Both, + Height = 0.5f, + Blending = BlendingMode.Additive, + Colour = ColourInfo.GradientVertical(Color4.White.Opacity(alpha), Color4.Transparent) + } + }; + + public Color4 AccentColour + { + get { return Colour; } + set { Colour = value; } + } + } +} diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index 3161ae8d7f..8fc10b7cc4 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -71,6 +71,7 @@ + From 27e3c9e778f64367f3c4a6d584728d52fb440843 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 12 Sep 2017 11:51:19 +0900 Subject: [PATCH 4/5] Remove usings. --- osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs index a62e0260bd..1be91a7d94 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs @@ -1,8 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Beatmaps; -using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Taiko.Objects From 585e2399bf452b8226a5a5c5f839dc94b83c97fd Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 12 Sep 2017 12:02:56 +0900 Subject: [PATCH 5/5] Add license headers. --- .../Objects/Drawables/Pieces/GlowPiece.cs | 5 ++++- .../Objects/Drawables/Pieces/LaneGlowPiece.cs | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs index b08247b180..6f022f452f 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs @@ -1,4 +1,7 @@ -using osu.Framework.Extensions.Color4Extensions; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/LaneGlowPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/LaneGlowPiece.cs index 38652d50af..6d4ac2fb61 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/LaneGlowPiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/LaneGlowPiece.cs @@ -1,3 +1,6 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics;