diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 3c801744e8..4568685fb1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -1,7 +1,11 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.MathUtils; using osu.Framework.Screens.Testing; +using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Modes.Taiko.Objects; using osu.Game.Modes.Taiko.UI; namespace osu.Desktop.VisualTests.Tests @@ -10,14 +14,67 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => "Taiko playfield"; + private TaikoPlayfield playfield; + public override void Reset() { base.Reset(); - Add(new TaikoPlayfield + AddButton("Hit!", addHitJudgement); + AddButton("Miss :(", addMissJudgement); + + Add(playfield = new TaikoPlayfield { Y = 200 }); } + + private void addHitJudgement() + { + TaikoScoreResult score = RNG.Next(2) == 0 ? TaikoScoreResult.Good : TaikoScoreResult.Great; + + playfield.OnJudgement(new DrawableTestHit(new TaikoHitObject()) + { + Judgement = new TaikoJudgementInfo + { + Result = HitResult.Hit, + Score = score, + TimeOffset = 0, + ComboAtHit = 1 + } + }); + } + + private void addMissJudgement() + { + playfield.OnJudgement(new DrawableTestHit(new TaikoHitObject()) + { + Judgement = new TaikoJudgementInfo + { + Result = HitResult.Miss, + TimeOffset = 0, + ComboAtHit = 0 + } + }); + } + + private class DrawableTestHit : DrawableHitObject + { + public DrawableTestHit(TaikoHitObject hitObject) + : base(hitObject) + { + } + + protected override TaikoJudgementInfo CreateJudgementInfo() => new TaikoJudgementInfo(); + + protected override void UpdateState(ArmedState state) + { + } + + protected override void Update() + { + // Doesn't move + } + } } } diff --git a/osu.Game.Modes.Taiko/UI/RingExplosion.cs b/osu.Game.Modes.Taiko/UI/RingExplosion.cs new file mode 100644 index 0000000000..63e860e8c1 --- /dev/null +++ b/osu.Game.Modes.Taiko/UI/RingExplosion.cs @@ -0,0 +1,69 @@ +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transforms; +using osu.Game.Graphics; +using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Modes.Taiko.Objects; + +namespace osu.Game.Modes.Taiko.UI +{ + internal class RingExplosion : CircularContainer + { + public TaikoScoreResult ScoreResult; + + private Box innerFill; + + public RingExplosion() + { + Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2); + + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + RelativePositionAxes = Axes.Both; + + BorderColour = Color4.White; + BorderThickness = 1; + + Alpha = 0.15f; + + Children = new[] + { + innerFill = new Box + { + RelativeSizeAxes = Axes.Both, + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + switch (ScoreResult) + { + default: + break; + case TaikoScoreResult.Good: + innerFill.Colour = colours.Green; + break; + case TaikoScoreResult.Great: + innerFill.Colour = colours.Blue; + break; + } + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + ScaleTo(5f, 1000, EasingTypes.OutQuint); + FadeOut(500); + + Expire(); + } + } +} diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index a40693fa89..7aeebc0bdf 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -47,7 +47,7 @@ namespace osu.Game.Modes.Taiko.UI protected override Container Content => hitObjectContainer; private HitTarget hitTarget; - //private Container explosionRingContainer; + private Container ringExplosionContainer; //private Container barLineContainer; //private Container judgementContainer; @@ -103,14 +103,14 @@ namespace osu.Game.Modes.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - //explosionRingContainer = new Container - //{ - // Anchor = Anchor.CentreLeft, - // Origin = Anchor.Centre, - // Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), - // Scale = new Vector2(PLAYFIELD_SCALE), - // BlendingMode = BlendingMode.Additive - //}, + ringExplosionContainer = new Container + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.Centre, + Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), + Scale = new Vector2(PLAYFIELD_SCALE), + BlendingMode = BlendingMode.Additive + }, } }, //barLineContainer = new Container @@ -196,6 +196,13 @@ namespace osu.Game.Modes.Taiko.UI public override void OnJudgement(DrawableHitObject judgedObject) { + if (judgedObject.Judgement.Result == HitResult.Hit) + { + ringExplosionContainer.Add(new RingExplosion + { + ScoreResult = judgedObject.Judgement.Score + }); + } } } } \ 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 16ada59858..a12c2aee22 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -58,6 +58,7 @@ +