diff --git a/osu-resources b/osu-resources index 00406e13d1..4bb8dca669 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 00406e13d1b15683b3565a126e207b08bca7555f +Subproject commit 4bb8dca669c87c5acdd18e55a33f1ea5f566bb9c diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index ebe3800af4..18e31fa036 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -2,7 +2,11 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Graphics.Containers; using osu.Framework.Screens.Testing; +using osu.Game.Graphics; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; namespace osu.Desktop.VisualTests.Tests @@ -11,53 +15,151 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => "Taiko hit objects"; + private bool kiai; + public override void Reset() { base.Reset(); - Add(new CentreHitCirclePiece + AddToggle("Kiai", b => + { + kiai = !kiai; + Reset(); + }); + + Add(new CentreHitCircle(new CirclePiece(@"centre") + { + KiaiMode = kiai + }) { Position = new Vector2(100, 100) }); - Add(new FinisherPiece(new CentreHitCirclePiece()) + Add(new CentreHitCircle(new AccentedCirclePiece(@"centre") + { + KiaiMode = kiai + }) { Position = new Vector2(350, 100) }); - Add(new RimHitCirclePiece + Add(new RimHitCircle(new CirclePiece(@"rim") + { + KiaiMode = kiai + }) { Position = new Vector2(100, 300) }); - Add(new FinisherPiece(new RimHitCirclePiece()) + Add(new RimHitCircle(new AccentedCirclePiece(@"rim") + { + KiaiMode = kiai + }) { Position = new Vector2(350, 300) }); - Add(new BashCirclePiece + Add(new SwellCircle(new CirclePiece(@"swell") + { + KiaiMode = kiai + }) { Position = new Vector2(100, 500) }); - Add(new FinisherPiece(new BashCirclePiece()) + Add(new SwellCircle(new AccentedCirclePiece(@"swell") + { + KiaiMode = kiai + }) { Position = new Vector2(350, 500) }); - Add(new DrumRollCirclePiece + Add(new DrumRollCircle(new CirclePiece(string.Empty) { Width = 250, + KiaiMode = kiai + }) + { Position = new Vector2(575, 100) }); - Add(new FinisherPiece(new DrumRollCirclePiece() + Add(new DrumRollCircle(new AccentedCirclePiece(string.Empty) { - Width = 250 + Width = 250, + KiaiMode = kiai }) { Position = new Vector2(575, 300) }); } + + private class SwellCircle : BaseCircle + { + public SwellCircle(CirclePiece piece) + : base(piece) + { + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Piece.AccentColour = colours.YellowDark; + } + } + + private class DrumRollCircle : BaseCircle + { + public DrumRollCircle(CirclePiece piece) + : base(piece) + { + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Piece.AccentColour = colours.YellowDark; + } + } + + private class CentreHitCircle : BaseCircle + { + public CentreHitCircle(CirclePiece piece) + : base(piece) + { + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Piece.AccentColour = colours.PinkDarker; + } + } + + private class RimHitCircle : BaseCircle + { + public RimHitCircle(CirclePiece piece) + : base(piece) + { + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Piece.AccentColour = colours.BlueDarker; + } + } + + private abstract class BaseCircle : Container + { + protected readonly CirclePiece Piece; + + protected BaseCircle(CirclePiece piece) + { + Piece = piece; + + Add(Piece); + } + } } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index b0c7d020e1..e165f40442 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -49,6 +49,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable UpdateScrollPosition(Time.Current); } - protected abstract ScrollingPiece CreateCircle(); + protected abstract CirclePiece CreateCircle(); } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/AccentedCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/AccentedCirclePiece.cs new file mode 100644 index 0000000000..2d8b81d00e --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/AccentedCirclePiece.cs @@ -0,0 +1,14 @@ +using OpenTK; + +namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +{ + public class AccentedCirclePiece : CirclePiece + { + public AccentedCirclePiece(string symbolName) + : base(symbolName) + { + } + + public override Vector2 Size => new Vector2(base.Size.X, base.Size.Y * 1.5f); + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/BashCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/BashCirclePiece.cs deleted file mode 100644 index 64787808cd..0000000000 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/BashCirclePiece.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; -using osu.Game.Graphics; - -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces -{ - /// - /// A circle piece which is used to visualise Bash objects. - /// - public class BashCirclePiece : CirclePiece - { - private Sprite icon; - - protected override Framework.Graphics.Drawable CreateIcon() - { - return icon ?? (icon = new Sprite - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours, TextureStore textures) - { - AccentColour = colours.YellowDark; - - icon.Texture = textures.Get(@"Play/Taiko/bash-hit-inner"); - } - } -} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitCirclePiece.cs deleted file mode 100644 index 8bd28a4e2b..0000000000 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitCirclePiece.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; -using OpenTK; - -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces -{ - /// - /// A circle piece which is used to visualise CentreHit objects. - /// - public class CentreHitCirclePiece : CirclePiece - { - protected override Framework.Graphics.Drawable CreateIcon() - { - return new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(45f), - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both - } - } - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - AccentColour = colours.PinkDarker; - } - } -} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs index ddfcbb8852..7cdd09f7aa 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs @@ -8,6 +8,9 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Backgrounds; using OpenTK.Graphics; using OpenTK; +using osu.Framework.Graphics.Textures; +using osu.Framework.Allocation; +using System; namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces { @@ -18,15 +21,30 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces /// a regular "circle" is the result of setting Width to 0. /// /// - /// Hitobjects that have a length need only to set Width and the extra corner radius will be added internally. + /// Hitobjects that have a length (e.g. DrumRolls) need only to set Width and the extra corner radius will be added internally. /// /// - public abstract class CirclePiece : ScrollingPiece + public class CirclePiece : Container { + private Color4 accentColour; /// /// The colour of the inner circle and outer glows. /// - public Color4 AccentColour { get; protected set; } + public Color4 AccentColour + { + get { return accentColour; } + set + { + accentColour = value; + + innerBackground.Colour = AccentColour; + + triangles.ColourLight = AccentColour; + triangles.ColourDark = AccentColour.Darken(0.1f); + + resetEdgeEffects(); + } + } private bool kiaiMode; /// @@ -39,129 +57,99 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces { kiaiMode = value; - if (innerCircleContainer != null) - innerCircleContainer.EdgeEffect = value ? createKiaiEdgeEffect() : default(EdgeEffect); + resetEdgeEffects(); } } + public override Anchor Origin + { + get { return Anchor.CentreLeft; } + set { throw new InvalidOperationException($"{nameof(CirclePiece)} must always use CentreLeft origin."); } + } + public override Vector2 Size => new Vector2(base.Size.X, TaikoHitObject.CIRCLE_RADIUS * 2); private readonly Container innerLayer; - private readonly Container backingGlowContainer; private readonly Container innerCircleContainer; private readonly Box innerBackground; private readonly Triangles triangles; + private readonly Sprite symbol; - protected CirclePiece() + private readonly string symbolName; + + public CirclePiece(string symbolName) { - Container iconContainer; + this.symbolName = symbolName; - Children = new Framework.Graphics.Drawable[] + // The "inner layer" overshoots the the CirclePiece by Height/2 px on both sides + AddInternal(innerLayer = new Container { - // The "inner layer" overshoots the ObjectPiece by 64px on both sides - innerLayer = new Container + Name = "Inner Layer", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Y, + Children = new Framework.Graphics.Drawable[] { - Name = "Inner Layer", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Y, - Children = new Framework.Graphics.Drawable[] + innerCircleContainer = new CircularContainer { - backingGlowContainer = new CircularContainer + Name = "Inner Circle", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Masking = true, + Children = new Framework.Graphics.Drawable[] { - Name = "Backing Glow", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Masking = true, - Children = new[] + innerBackground = new Box { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true - } - } - }, - innerCircleContainer = new CircularContainer - { - Name = "Inner Circle", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Masking = true, - Children = new Framework.Graphics.Drawable[] + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + }, + triangles = new Triangles { - innerBackground = new Box - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - }, - triangles = new Triangles - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - } + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, } - }, - new CircularContainer - { - Name = "Ring", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - BorderThickness = 8, - BorderColour = Color4.White, - Masking = true, - Children = new[] - { - new Box - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true - } - } - }, - iconContainer = new Container - { - Name = "Icon Container", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, } + }, + new CircularContainer + { + Name = "Ring", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + BorderThickness = 8, + BorderColour = Color4.White, + Masking = true, + Children = new[] + { + new Box + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + } + } + }, + symbol = new Sprite + { + Name = "Symbol", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both } - }, - }; - - Framework.Graphics.Drawable icon = CreateIcon(); - - if (icon != null) - iconContainer.Add(icon); + } + }); } - protected override void LoadComplete() + [BackgroundDependencyLoader] + private void load(TextureStore textures) { - base.LoadComplete(); - - backingGlowContainer.EdgeEffect = new EdgeEffect - { - Type = EdgeEffectType.Glow, - Colour = AccentColour, - Radius = 8 - }; - - if (KiaiMode) - innerCircleContainer.EdgeEffect = createKiaiEdgeEffect(); - - innerBackground.Colour = AccentColour; - - triangles.ColourLight = AccentColour; - triangles.ColourDark = AccentColour.Darken(0.1f); + if (!string.IsNullOrEmpty(symbolName)) + symbol.Texture = textures.Get($@"Play/Taiko/{symbolName}-symbol"); } protected override void Update() @@ -169,20 +157,14 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces innerLayer.Width = DrawWidth + DrawHeight; } - private EdgeEffect createKiaiEdgeEffect() + private void resetEdgeEffects() { - return new EdgeEffect + innerCircleContainer.EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Glow, Colour = AccentColour, - Radius = 50 + Radius = KiaiMode ? 50 : 8 }; } - - /// - /// Creates the icon that's shown in the middle of this object piece. - /// - /// The icon. - protected virtual Framework.Graphics.Drawable CreateIcon() => null; } } \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs deleted file mode 100644 index fea538d654..0000000000 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Game.Graphics; - -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces -{ - /// - /// A circle piece which is used to visualise DrumRoll objects. - /// - public class DrumRollCirclePiece : CirclePiece - { - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - AccentColour = colours.YellowDark; - } - } -} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/FinisherPiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/FinisherPiece.cs deleted file mode 100644 index 754ba79cc2..0000000000 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/FinisherPiece.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK; - -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces -{ - /// - /// A type of circle piece that encapsulates a circle piece to visualise it as a "finisher" hitobject. - /// - /// Finisher hitobjects are 1.5x larger, while maintaining the same length. - /// - /// - public class FinisherPiece : ScrollingPiece - { - public FinisherPiece(ScrollingPiece original) - { - // First we scale the note up - Scale = new Vector2(1.5f); - - Children = new[] - { - original - }; - - // Next we reduce the draw width for drum rolls to keep the width - // equal to that of a non-finisher drum roll - original.Width /= 1.5f; - } - } -} diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitCirclePiece.cs deleted file mode 100644 index 96563c5350..0000000000 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitCirclePiece.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; -using OpenTK; -using OpenTK.Graphics; - -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces -{ - /// - /// A circle piece which is used to visualise RimHit objects. - /// - public class RimHitCirclePiece : CirclePiece - { - protected override Framework.Graphics.Drawable CreateIcon() - { - return new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(61f), - BorderThickness = 8, - BorderColour = Color4.White, - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true - } - } - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - AccentColour = colours.BlueDarker; - } - } -} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/ScrollingPiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/ScrollingPiece.cs deleted file mode 100644 index 0e1fef015b..0000000000 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/ScrollingPiece.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; - -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces -{ - /// - /// A type of circle piece that will be scrolling the screen. - /// - /// A scrolling circle piece must always have a centre-left origin due to how scroll position is calculated. - /// - /// - public class ScrollingPiece : Container - { - public override Anchor Origin => Anchor.CentreLeft; - } -} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index fdb789d57b..25c3052583 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -54,16 +54,11 @@ + - - - - - -