From 58be4548ef34218bad1ba053f5808ad3fb7105fe Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 14:53:55 +0900 Subject: [PATCH 01/33] Late-add the HitObjects container in the Playfield. Allows derivers to define the Content container in the constructor, to redirect the positioning of the HitObjects container. --- osu.Game/Modes/UI/Playfield.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Modes/UI/Playfield.cs index bff461f649..e5babecad9 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Modes/UI/Playfield.cs @@ -7,6 +7,7 @@ using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Drawables; using OpenTK; using osu.Game.Modes.Judgements; +using osu.Framework.Allocation; namespace osu.Game.Modes.UI { @@ -45,10 +46,16 @@ namespace osu.Game.Modes.UI } }); - Add(HitObjects = new HitObjectContainer> + HitObjects = new HitObjectContainer> { RelativeSizeAxes = Axes.Both, - }); + }; + } + + [BackgroundDependencyLoader] + private void load() + { + Add(HitObjects); } /// From 27a21cd23d8422147a47cdaec7413c7ab208d5e4 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 14:58:34 +0900 Subject: [PATCH 02/33] Add taiko playfield. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 1 + osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs new file mode 100644 index 0000000000..2ed38c84d5 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -0,0 +1 @@ +using osu.Framework.Screens.Testing; diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 68aed38b34..aa4f782c22 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -23,7 +23,7 @@ false LocalIntranet v4.5 - true + true publish\ true Disk @@ -194,6 +194,7 @@ + From 10ed6ef10d48339df8e8d83d4ffff6b824fee79b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 15:09:54 +0900 Subject: [PATCH 03/33] Move TaikoPlayfield to separate file. --- .../Tests/TestCaseTaikoPlayfield.cs | 22 ++ osu.Game.Modes.Taiko/UI/HitTarget.cs | 153 ++++++++++++++ osu.Game.Modes.Taiko/UI/InputDrum.cs | 142 +++++++++++++ osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 189 ++++++++++++++++-- .../osu.Game.Modes.Taiko.csproj | 2 + 5 files changed, 493 insertions(+), 15 deletions(-) create mode 100644 osu.Game.Modes.Taiko/UI/HitTarget.cs create mode 100644 osu.Game.Modes.Taiko/UI/InputDrum.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 2ed38c84d5..3c801744e8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -1 +1,23 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + using osu.Framework.Screens.Testing; +using osu.Game.Modes.Taiko.UI; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseTaikoPlayfield : TestCase + { + public override string Description => "Taiko playfield"; + + public override void Reset() + { + base.Reset(); + + Add(new TaikoPlayfield + { + Y = 200 + }); + } + } +} diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs new file mode 100644 index 0000000000..b370f6f486 --- /dev/null +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -0,0 +1,153 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// 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.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Framework.Graphics.Transforms; +using osu.Game.Modes.Taiko.Objects; + +namespace osu.Game.Modes.Taiko.UI +{ + internal class HitTarget : Container + { + private Sprite outer; + private Sprite inner; + + private Container innerFlash; + private Container outerFlash; + + public HitTarget() + { + Children = new Drawable[] + { + new Box + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Size = new Vector2(5, TaikoPlayfield.PlayfieldHeight), + + Colour = Color4.Black + }, + new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2 * 1.5f), + Scale = new Vector2(TaikoPlayfield.PLAYFIELD_SCALE), + + Children = new Drawable[] + { + outer = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + }, + inner = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + Size = new Vector2(1 / 1.5f) + }, + new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + + Children = new Drawable[] + { + outerFlash = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2 * 1.5f, 680), + + Masking = true, + CornerRadius = TaikoHitObject.CIRCLE_RADIUS * 2 * 1.5f, + + Alpha = 0, + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + + Alpha = 0, + AlwaysPresent = true + } + } + }, + innerFlash = new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + + Masking = true, + + Alpha = 0, + + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + + Colour = Color4.White.Opacity(0.85f), + } + }, + } + } + } + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + outer.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer"); + inner.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner"); + } + + public void Flash(Color4 colour) + { + innerFlash.EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Glow, + Colour = colour, + Radius = 20 + }; + + outerFlash.EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Glow, + Colour = colour, + Radius = 250 + }; + + outerFlash.FadeTo(0.3f, 125, EasingTypes.OutQuint); + outerFlash.Delay(125).FadeOut(125); + + innerFlash.FadeIn(); + innerFlash.FadeOut(250, EasingTypes.OutQuint); + } + } +} diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs new file mode 100644 index 0000000000..59ab579a63 --- /dev/null +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -0,0 +1,142 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Input; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Framework.Graphics.Transforms; +using osu.Framework.Input; +using osu.Game.Graphics; +using System.Collections.Generic; + +namespace osu.Game.Modes.Taiko.UI +{ + internal class InputDrum : Container + { + public InputDrum() + { + Size = new Vector2(TaikoPlayfield.PlayfieldHeight); + + Children = new Drawable[] + { + new TaikoHalfDrum(false) + { + Anchor = Anchor.Centre, + Origin = Anchor.CentreRight, + + RelativeSizeAxes = Axes.Both, + + Keys = new List(new[] { Key.F, Key.D }) + }, + new TaikoHalfDrum(true) + { + Anchor = Anchor.Centre, + Origin = Anchor.CentreLeft, + + RelativeSizeAxes = Axes.Both, + + Position = new Vector2(-1f, 0), + + Keys = new List(new[] { Key.J, Key.K }) + } + }; + } + + private class TaikoHalfDrum : Container + { + /// + /// Keys[0] -> Inner key + /// Keys[0] -> Outer key + /// + public List Keys = new List(); + + private Sprite outer; + private Sprite outerHit; + private Sprite inner; + private Sprite innerHit; + + public TaikoHalfDrum(bool flipped) + { + Masking = true; + + Children = new Drawable[] + { + outer = new Sprite + { + Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both + }, + outerHit = new Sprite + { + Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + + Alpha = 0, + + BlendingMode = BlendingMode.Additive + }, + inner = new Sprite + { + Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + Size = new Vector2(0.7f) + }, + innerHit = new Sprite + { + Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + Size = new Vector2(0.7f), + + Alpha = 0, + + BlendingMode = BlendingMode.Additive + } + }; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures, OsuColour colours) + { + outer.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer"); + outerHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer-hit"); + inner.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner"); + innerHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner-hit"); + + outerHit.Colour = colours.Blue; + innerHit.Colour = colours.Pink; + } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Repeat) + return false; + + if (args.Key == Keys[0]) + { + innerHit.FadeIn(); + innerHit.FadeOut(500, EasingTypes.OutQuint); + } + + if (args.Key == Keys[1]) + { + outerHit.FadeIn(); + outerHit.FadeOut(500, EasingTypes.OutQuint); + } + + return false; + } + } + } +} diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index f3ae600501..a40693fa89 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -4,39 +4,198 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; using osu.Game.Modes.Taiko.Objects; using osu.Game.Modes.UI; using OpenTK; using OpenTK.Graphics; using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Modes.Objects.Drawables; +using osu.Game.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics.Primitives; namespace osu.Game.Modes.Taiko.UI { public class TaikoPlayfield : Playfield { + /// + /// The default play field height. + /// + public const float PLAYFIELD_BASE_HEIGHT = 242; + + /// + /// The play field height scale. + /// + public const float PLAYFIELD_SCALE = 0.65f; + + /// + /// The play field height after scaling. + /// + public static float PlayfieldHeight => PLAYFIELD_BASE_HEIGHT * PLAYFIELD_SCALE; + + /// + /// The offset from which the center of the hit target lies at. + /// + private const float hit_target_offset = 80; + + /// + /// The size of the left area of the playfield. This area contains the input drum. + /// + private const float left_area_size = 240; + + protected override Container Content => hitObjectContainer; + + private HitTarget hitTarget; + //private Container explosionRingContainer; + //private Container barLineContainer; + //private Container judgementContainer; + + private Container hitObjectContainer; + private Container topLevelHitContainer; + private Container leftBackgroundContainer; + private Container rightBackgroundContainer; + private Box leftBackground; + private Box rightBackground; + public TaikoPlayfield() { RelativeSizeAxes = Axes.X; - Size = new Vector2(1, 100); - Anchor = Anchor.Centre; - Origin = Anchor.Centre; + Height = PlayfieldHeight; + + AddInternal(new Drawable[] + { + rightBackgroundContainer = new Container + { + RelativeSizeAxes = Axes.Both, + BorderThickness = 2, + Masking = true, + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.2f), + Radius = 5, + }, + Children = new Drawable[] + { + rightBackground = new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0.6f + }, + } + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = left_area_size }, + Children = new Drawable[] + { + new Container + { + Padding = new MarginPadding { Left = hit_target_offset }, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new Container + { + Name = @"Hit target", + 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 + //}, + } + }, + //barLineContainer = new Container + //{ + // RelativeSizeAxes = Axes.Both, + //}, + hitTarget = new HitTarget + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.Centre, + }, + hitObjectContainer = new Container + { + RelativeSizeAxes = Axes.Both, + }, + //judgementContainer = new Container + //{ + // RelativeSizeAxes = Axes.Both, + // BlendingMode = BlendingMode.Additive + //}, + }, + }, + } + }, + leftBackgroundContainer = new Container + { + Size = new Vector2(left_area_size, PlayfieldHeight), + BorderThickness = 1, + Children = new Drawable[] + { + leftBackground = new Box + { + RelativeSizeAxes = Axes.Both, + }, + new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativePositionAxes = Axes.X, + Position = new Vector2(0.10f, 0), + Children = new Drawable[] + { + new InputDrum + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Scale = new Vector2(0.9f) + }, + } + }, + new Box + { + Anchor = Anchor.TopRight, + RelativeSizeAxes = Axes.Y, + Width = 10, + ColourInfo = Framework.Graphics.Colour.ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.6f), Color4.Black.Opacity(0)), + }, + } + }, + topLevelHitContainer = new Container + { + RelativeSizeAxes = Axes.Both, + } + }); } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private void load(OsuColour colours) { - Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f }); + leftBackgroundContainer.BorderColour = colours.Gray0; + leftBackground.Colour = colours.Gray1; - Add(new Sprite - { - Texture = textures.Get(@"Menu/logo"), - Origin = Anchor.Centre, - Scale = new Vector2(0.2f), - RelativePositionAxes = Axes.Both, - Position = new Vector2(0.1f, 0.5f), - Colour = Color4.Gray - }); + rightBackgroundContainer.BorderColour = colours.Gray1; + rightBackground.Colour = colours.Gray0; + } + + public override void Add(DrawableHitObject h) + { + h.Depth = (float)h.HitObject.StartTime; + + base.Add(h); + } + + public override void OnJudgement(DrawableHitObject judgedObject) + { } } } \ 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 7ea6dfeadb..a4d87b096a 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -55,6 +55,8 @@ + + From 4c398b106d6f171804a0e1295ecb453d64b20018 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 15:54:57 +0900 Subject: [PATCH 04/33] Add explosion rings. --- .../Tests/TestCaseTaikoPlayfield.cs | 59 +++++++++++++++- osu.Game.Modes.Taiko/UI/RingExplosion.cs | 69 +++++++++++++++++++ osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 25 ++++--- .../osu.Game.Modes.Taiko.csproj | 1 + 4 files changed, 144 insertions(+), 10 deletions(-) create mode 100644 osu.Game.Modes.Taiko/UI/RingExplosion.cs 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 @@ + From 1ac9898a36e135341054f6a5f9f9e537fe55bb6c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 16:33:25 +0900 Subject: [PATCH 05/33] Add judgement texts. --- .../Tests/TestCaseTaikoPlayfield.cs | 1 + osu.Game.Modes.Taiko/UI/JudgementText.cs | 126 ++++++++++++++++++ osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 25 +++- .../osu.Game.Modes.Taiko.csproj | 1 + 4 files changed, 147 insertions(+), 6 deletions(-) create mode 100644 osu.Game.Modes.Taiko/UI/JudgementText.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 4568685fb1..2e20c44ab7 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -35,6 +35,7 @@ namespace osu.Desktop.VisualTests.Tests playfield.OnJudgement(new DrawableTestHit(new TaikoHitObject()) { + X = RNG.NextSingle(score == TaikoScoreResult.Good ? -0.1f : -0.05f, score == TaikoScoreResult.Good ? 0.1f : 0.05f), Judgement = new TaikoJudgementInfo { Result = HitResult.Hit, diff --git a/osu.Game.Modes.Taiko/UI/JudgementText.cs b/osu.Game.Modes.Taiko/UI/JudgementText.cs new file mode 100644 index 0000000000..b35f81b2a0 --- /dev/null +++ b/osu.Game.Modes.Taiko/UI/JudgementText.cs @@ -0,0 +1,126 @@ +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Transforms; +using osu.Game.Graphics.Sprites; +using OpenTK; +using OpenTK.Graphics; +using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Modes.Objects.Drawables; +using osu.Framework.Allocation; +using osu.Game.Graphics; + +namespace osu.Game.Modes.Taiko.UI +{ + public class JudgementText : Container + { + public TaikoJudgementInfo Judgement; + + private Container textContainer; + private OsuSpriteText glowText; + private OsuSpriteText normalText; + + private int movementDirection; + + public JudgementText() + { + AutoSizeAxes = Axes.Both; + + Children = new Drawable[] + { + textContainer = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + AutoSizeAxes = Axes.Both, + + Children = new Drawable[] + { + new BufferedContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + BlurSigma = new Vector2(10), + CacheDrawnFrameBuffer = true, + + RelativeSizeAxes = Axes.Both, + Size = new Vector2(3), + + BlendingMode = BlendingMode.Additive, + + Children = new[] + { + glowText = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Font = "Venera", + TextSize = 22f, + } + } + }, + normalText = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Font = "Venera", + TextSize = 22f, + } + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Color4 judgementColour = Color4.White; + string judgementText = string.Empty; + + switch (Judgement.Result) + { + case HitResult.Miss: + judgementColour = colours.Red; + judgementText = "MISS"; + movementDirection = 1; + break; + case HitResult.Hit: + switch (Judgement.Score) + { + case TaikoScoreResult.Good: + judgementColour = colours.Green; + judgementText = "GOOD"; + textContainer.Scale = new Vector2(0.45f); + break; + case TaikoScoreResult.Great: + judgementColour = colours.Blue; + judgementText = "GREAT"; + break; + } + + movementDirection = -1; + break; + } + + glowText.Colour = judgementColour; + glowText.Text = normalText.Text = judgementText; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + ScaleTo(1.5f, 250, EasingTypes.OutQuint); + MoveToY(movementDirection * 100, 500); + + Delay(250); + ScaleTo(0.75f, 250); + FadeOut(250); + + Expire(); + } + } +} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 7aeebc0bdf..2295f498c7 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -49,7 +49,7 @@ namespace osu.Game.Modes.Taiko.UI private HitTarget hitTarget; private Container ringExplosionContainer; //private Container barLineContainer; - //private Container judgementContainer; + private Container judgementContainer; private Container hitObjectContainer; private Container topLevelHitContainer; @@ -126,11 +126,11 @@ namespace osu.Game.Modes.Taiko.UI { RelativeSizeAxes = Axes.Both, }, - //judgementContainer = new Container - //{ - // RelativeSizeAxes = Axes.Both, - // BlendingMode = BlendingMode.Additive - //}, + judgementContainer = new Container + { + RelativeSizeAxes = Axes.Both, + BlendingMode = BlendingMode.Additive + }, }, }, } @@ -203,6 +203,19 @@ namespace osu.Game.Modes.Taiko.UI ScoreResult = judgedObject.Judgement.Score }); } + + float judgementOffset = judgedObject.Judgement.Result == HitResult.Hit ? judgedObject.Position.X : 0; + + judgementContainer.Add(new JudgementText + { + Anchor = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.TopLeft : Anchor.BottomLeft, + Origin = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.BottomCentre : Anchor.TopCentre, + + RelativePositionAxes = Axes.X, + X = judgementOffset, + + Judgement = judgedObject.Judgement + }); } } } \ 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 a12c2aee22..372f9ba6fd 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 @@ + From 4e7a44cd441f370fbd8ece897075078e70c18bce Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 16:40:37 +0900 Subject: [PATCH 06/33] Add license + general fixes. --- osu.Game.Modes.Taiko/UI/JudgementText.cs | 5 ++++- osu.Game.Modes.Taiko/UI/RingExplosion.cs | 7 ++++--- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/JudgementText.cs b/osu.Game.Modes.Taiko/UI/JudgementText.cs index b35f81b2a0..f7ccd4a5ec 100644 --- a/osu.Game.Modes.Taiko/UI/JudgementText.cs +++ b/osu.Game.Modes.Taiko/UI/JudgementText.cs @@ -1,4 +1,7 @@ -using osu.Framework.Graphics; +// 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; using osu.Framework.Graphics.Transforms; using osu.Game.Graphics.Sprites; diff --git a/osu.Game.Modes.Taiko/UI/RingExplosion.cs b/osu.Game.Modes.Taiko/UI/RingExplosion.cs index 63e860e8c1..16037de22a 100644 --- a/osu.Game.Modes.Taiko/UI/RingExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/RingExplosion.cs @@ -1,4 +1,7 @@ -using OpenTK; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// 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; @@ -45,8 +48,6 @@ namespace osu.Game.Modes.Taiko.UI { switch (ScoreResult) { - default: - break; case TaikoScoreResult.Good: innerFill.Colour = colours.Green; break; diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 2295f498c7..d0829d2fac 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -46,12 +46,14 @@ namespace osu.Game.Modes.Taiko.UI protected override Container Content => hitObjectContainer; + // ReSharper disable once NotAccessedField.Local private HitTarget hitTarget; private Container ringExplosionContainer; //private Container barLineContainer; private Container judgementContainer; private Container hitObjectContainer; + // ReSharper disable once NotAccessedField.Local private Container topLevelHitContainer; private Container leftBackgroundContainer; private Container rightBackgroundContainer; From eec4a1b5d37110858cd875297b63769ad0b8e379 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 17:48:19 +0900 Subject: [PATCH 07/33] Redesign HitTarget. --- osu.Game.Modes.Taiko/UI/HitTarget.cs | 172 +++++++++------------------ 1 file changed, 58 insertions(+), 114 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs index b370f6f486..496f3741d7 100644 --- a/osu.Game.Modes.Taiko/UI/HitTarget.cs +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -3,151 +3,95 @@ using OpenTK; using OpenTK.Graphics; -using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.Transforms; using osu.Game.Modes.Taiko.Objects; namespace osu.Game.Modes.Taiko.UI { internal class HitTarget : Container { - private Sprite outer; - private Sprite inner; - - private Container innerFlash; - private Container outerFlash; + private const float normal_diameter = TaikoHitObject.CIRCLE_RADIUS * 2 * TaikoPlayfield.PLAYFIELD_SCALE; + private const float finisher_diameter = normal_diameter * 1.5f; public HitTarget() { + RelativeSizeAxes = Axes.Y; + Children = new Drawable[] { new Box { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, + Name = "Bar Upper", - Size = new Vector2(5, TaikoPlayfield.PlayfieldHeight), + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, - Colour = Color4.Black + Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f), + + Alpha = 0.1f }, - new Container + new CircularContainer { + Name = "Finisher Ring", + Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2 * 1.5f), - Scale = new Vector2(TaikoPlayfield.PLAYFIELD_SCALE), + Size = new Vector2(finisher_diameter), - Children = new Drawable[] + BorderColour = Color4.White, + BorderThickness = 2, + Alpha = 0.1f, + + Children = new[] { - outer = new Sprite + new Box { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - - RelativeSizeAxes = Axes.Both, - }, - inner = new Sprite - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - - RelativeSizeAxes = Axes.Both, - Size = new Vector2(1 / 1.5f) - }, - new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - outerFlash = new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - - Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2 * 1.5f, 680), - - Masking = true, - CornerRadius = TaikoHitObject.CIRCLE_RADIUS * 2 * 1.5f, - - Alpha = 0, - - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - - Alpha = 0, - AlwaysPresent = true - } - } - }, - innerFlash = new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - - RelativeSizeAxes = Axes.Both, - - Masking = true, - - Alpha = 0, - - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - - Colour = Color4.White.Opacity(0.85f), - } - }, - } - } + Alpha = 0, + AlwaysPresent = true } } - } + }, + new CircularContainer + { + Name = "Normal Ring", + + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Size = new Vector2(normal_diameter), + + BorderColour = Color4.White, + BorderThickness = 2, + Alpha = 0.5f, + + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + + Alpha = 0, + AlwaysPresent = true + } + } + }, + new Box + { + Name = "Bar Lower", + + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + + Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f), + + Alpha = 0.1f + }, }; } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - outer.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer"); - inner.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner"); - } - - public void Flash(Color4 colour) - { - innerFlash.EdgeEffect = new EdgeEffect - { - Type = EdgeEffectType.Glow, - Colour = colour, - Radius = 20 - }; - - outerFlash.EdgeEffect = new EdgeEffect - { - Type = EdgeEffectType.Glow, - Colour = colour, - Radius = 250 - }; - - outerFlash.FadeTo(0.3f, 125, EasingTypes.OutQuint); - outerFlash.Delay(125).FadeOut(125); - - innerFlash.FadeIn(); - innerFlash.FadeOut(250, EasingTypes.OutQuint); - } } } From 60e866aebd5d53f1109d0aa5b875deefa51c5b5a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 17:49:22 +0900 Subject: [PATCH 08/33] Increase RingExplosion base size for finishers. Subtle but looks good imo (checked with flyte). --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 3 ++- osu.Game.Modes.Taiko/UI/RingExplosion.cs | 7 +++++-- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 2e20c44ab7..b61ada57a3 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -41,7 +41,8 @@ namespace osu.Desktop.VisualTests.Tests Result = HitResult.Hit, Score = score, TimeOffset = 0, - ComboAtHit = 1 + ComboAtHit = 1, + SecondHit = RNG.Next(2) == 0 } }); } diff --git a/osu.Game.Modes.Taiko/UI/RingExplosion.cs b/osu.Game.Modes.Taiko/UI/RingExplosion.cs index 16037de22a..e7dcda086d 100644 --- a/osu.Game.Modes.Taiko/UI/RingExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/RingExplosion.cs @@ -16,7 +16,7 @@ namespace osu.Game.Modes.Taiko.UI { internal class RingExplosion : CircularContainer { - public TaikoScoreResult ScoreResult; + public TaikoJudgementInfo Judgement; private Box innerFill; @@ -46,7 +46,10 @@ namespace osu.Game.Modes.Taiko.UI [BackgroundDependencyLoader] private void load(OsuColour colours) { - switch (ScoreResult) + if (Judgement.SecondHit) + Size *= 1.5f; + + switch (Judgement.Score) { case TaikoScoreResult.Good: innerFill.Colour = colours.Green; diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index d0829d2fac..808e417e46 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -202,7 +202,7 @@ namespace osu.Game.Modes.Taiko.UI { ringExplosionContainer.Add(new RingExplosion { - ScoreResult = judgedObject.Judgement.Score + Judgement = judgedObject.Judgement }); } From 2cfab75bc78499abb7ff4463d7501778a5ad8ac5 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 17:50:05 +0900 Subject: [PATCH 09/33] Remove now unnecessary field. --- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 808e417e46..1b1b445995 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -46,8 +46,6 @@ namespace osu.Game.Modes.Taiko.UI protected override Container Content => hitObjectContainer; - // ReSharper disable once NotAccessedField.Local - private HitTarget hitTarget; private Container ringExplosionContainer; //private Container barLineContainer; private Container judgementContainer; @@ -119,7 +117,7 @@ namespace osu.Game.Modes.Taiko.UI //{ // RelativeSizeAxes = Axes.Both, //}, - hitTarget = new HitTarget + new HitTarget { Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, From aac4f24a2e3b0f7a607006ac64dddce004e6bc05 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 17:55:18 +0900 Subject: [PATCH 10/33] 10% chance to get finisher hits in testcase. --- 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 b61ada57a3..787bca5832 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -42,7 +42,7 @@ namespace osu.Desktop.VisualTests.Tests Score = score, TimeOffset = 0, ComboAtHit = 1, - SecondHit = RNG.Next(2) == 0 + SecondHit = RNG.Next(10) == 0 } }); } From 7cb237798a8a1c08e0353229d4247bcb1ebd0d29 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 18:13:10 +0900 Subject: [PATCH 11/33] Add a 1px offset for the playfield border. --- osu.Game.Modes.Taiko/UI/HitTarget.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs index 496f3741d7..c7b60e871f 100644 --- a/osu.Game.Modes.Taiko/UI/HitTarget.cs +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -14,6 +14,7 @@ namespace osu.Game.Modes.Taiko.UI { private const float normal_diameter = TaikoHitObject.CIRCLE_RADIUS * 2 * TaikoPlayfield.PLAYFIELD_SCALE; private const float finisher_diameter = normal_diameter * 1.5f; + private const float border_offset = 1; public HitTarget() { @@ -28,7 +29,9 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f), + Y = border_offset, + + Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f - border_offset), Alpha = 0.1f }, @@ -87,7 +90,9 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f), + Y = -border_offset, + + Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f - border_offset), Alpha = 0.1f }, From e2b510f3f0c09c039802c62dde531fa3d8a336db Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 18:16:14 +0900 Subject: [PATCH 12/33] Add comments. --- osu.Game.Modes.Taiko/UI/HitTarget.cs | 14 ++++++++++++++ osu.Game.Modes.Taiko/UI/InputDrum.cs | 16 ++++++++++++++-- osu.Game.Modes.Taiko/UI/JudgementText.cs | 6 ++++++ osu.Game.Modes.Taiko/UI/RingExplosion.cs | 6 ++++++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs index c7b60e871f..9f20e1da0c 100644 --- a/osu.Game.Modes.Taiko/UI/HitTarget.cs +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -10,10 +10,24 @@ using osu.Game.Modes.Taiko.Objects; namespace osu.Game.Modes.Taiko.UI { + /// + /// A component that is displayed at the hit position in the taiko playfield. + /// internal class HitTarget : Container { + /// + /// Diameter of normal hit object circles. + /// private const float normal_diameter = TaikoHitObject.CIRCLE_RADIUS * 2 * TaikoPlayfield.PLAYFIELD_SCALE; + + /// + /// Diameter of finisher hit object circles. + /// private const float finisher_diameter = normal_diameter * 1.5f; + + /// + /// The 1px inner border of the taiko playfield. + /// private const float border_offset = 1; public HitTarget() diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs index 59ab579a63..607fd205bb 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -15,6 +15,9 @@ using System.Collections.Generic; namespace osu.Game.Modes.Taiko.UI { + /// + /// A component of the playfield that captures input and displays input as a drum. + /// internal class InputDrum : Container { public InputDrum() @@ -25,6 +28,8 @@ namespace osu.Game.Modes.Taiko.UI { new TaikoHalfDrum(false) { + Name = "Left Half", + Anchor = Anchor.Centre, Origin = Anchor.CentreRight, @@ -34,6 +39,8 @@ namespace osu.Game.Modes.Taiko.UI }, new TaikoHalfDrum(true) { + Name = "Right Half", + Anchor = Anchor.Centre, Origin = Anchor.CentreLeft, @@ -46,11 +53,16 @@ namespace osu.Game.Modes.Taiko.UI }; } + /// + /// A half-drum. Contains one centre and one rim hit. + /// private class TaikoHalfDrum : Container { /// - /// Keys[0] -> Inner key - /// Keys[0] -> Outer key + /// A list of keys which this half-drum accepts. + /// + /// [0] => Inner key, [1] => Outer key + /// /// public List Keys = new List(); diff --git a/osu.Game.Modes.Taiko/UI/JudgementText.cs b/osu.Game.Modes.Taiko/UI/JudgementText.cs index f7ccd4a5ec..a65e85e0af 100644 --- a/osu.Game.Modes.Taiko/UI/JudgementText.cs +++ b/osu.Game.Modes.Taiko/UI/JudgementText.cs @@ -14,8 +14,14 @@ using osu.Game.Graphics; namespace osu.Game.Modes.Taiko.UI { + /// + /// Text that is shown as judgement when a hit object is hit or missed. + /// public class JudgementText : Container { + /// + /// The Judgement to display. + /// public TaikoJudgementInfo Judgement; private Container textContainer; diff --git a/osu.Game.Modes.Taiko/UI/RingExplosion.cs b/osu.Game.Modes.Taiko/UI/RingExplosion.cs index e7dcda086d..e405fa0bfb 100644 --- a/osu.Game.Modes.Taiko/UI/RingExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/RingExplosion.cs @@ -14,8 +14,14 @@ using osu.Game.Modes.Taiko.Objects; namespace osu.Game.Modes.Taiko.UI { + /// + /// A ring that explodes to indicate a judgement has occurred. + /// internal class RingExplosion : CircularContainer { + /// + /// The Judgement to display. + /// public TaikoJudgementInfo Judgement; private Box innerFill; From 259ed03610fcb5ee425bebceb84aaa3d3c5c8341 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 18:28:04 +0900 Subject: [PATCH 13/33] Reduce some container nesting. --- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 34 +++++++---------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 1b1b445995..b2248e2c3e 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -97,21 +97,13 @@ namespace osu.Game.Modes.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new Container + ringExplosionContainer = new Container { - Name = @"Hit target", - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - ringExplosionContainer = new Container - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.Centre, - Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), - Scale = new Vector2(PLAYFIELD_SCALE), - BlendingMode = BlendingMode.Additive - }, - } + Anchor = Anchor.CentreLeft, + Origin = Anchor.Centre, + Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), + Scale = new Vector2(PLAYFIELD_SCALE), + BlendingMode = BlendingMode.Additive }, //barLineContainer = new Container //{ @@ -145,21 +137,15 @@ namespace osu.Game.Modes.Taiko.UI { RelativeSizeAxes = Axes.Both, }, - new Container + new InputDrum { Anchor = Anchor.Centre, Origin = Anchor.Centre, + RelativePositionAxes = Axes.X, Position = new Vector2(0.10f, 0), - Children = new Drawable[] - { - new InputDrum - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Scale = new Vector2(0.9f) - }, - } + + Scale = new Vector2(0.9f) }, new Box { From b769c436605ea8a5a5771ef110127255d8c4ce4a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 22 Mar 2017 01:39:39 +0900 Subject: [PATCH 14/33] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index e6394035d4..a4fc38818e 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit e6394035d443d4498b71e845e5763dd3faf98c7c +Subproject commit a4fc38818ea64313fa72fc169a7087047a74839c From e7a93073a445e15007929844f62bd537da4ee858 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 22 Mar 2017 01:42:40 +0900 Subject: [PATCH 15/33] Fix post-merge errors. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 6 +++--- osu.Game.Modes.Taiko/UI/JudgementText.cs | 6 +++--- osu.Game.Modes.Taiko/UI/RingExplosion.cs | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 787bca5832..488b2f192e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -31,15 +31,15 @@ namespace osu.Desktop.VisualTests.Tests private void addHitJudgement() { - TaikoScoreResult score = RNG.Next(2) == 0 ? TaikoScoreResult.Good : TaikoScoreResult.Great; + TaikoHitResult hitResult = RNG.Next(2) == 0 ? TaikoHitResult.Good : TaikoHitResult.Great; playfield.OnJudgement(new DrawableTestHit(new TaikoHitObject()) { - X = RNG.NextSingle(score == TaikoScoreResult.Good ? -0.1f : -0.05f, score == TaikoScoreResult.Good ? 0.1f : 0.05f), + X = RNG.NextSingle(hitResult == TaikoHitResult.Good ? -0.1f : -0.05f, hitResult == TaikoHitResult.Good ? 0.1f : 0.05f), Judgement = new TaikoJudgementInfo { Result = HitResult.Hit, - Score = score, + TaikoResult = hitResult, TimeOffset = 0, ComboAtHit = 1, SecondHit = RNG.Next(10) == 0 diff --git a/osu.Game.Modes.Taiko/UI/JudgementText.cs b/osu.Game.Modes.Taiko/UI/JudgementText.cs index a65e85e0af..5156020931 100644 --- a/osu.Game.Modes.Taiko/UI/JudgementText.cs +++ b/osu.Game.Modes.Taiko/UI/JudgementText.cs @@ -97,14 +97,14 @@ namespace osu.Game.Modes.Taiko.UI movementDirection = 1; break; case HitResult.Hit: - switch (Judgement.Score) + switch (Judgement.TaikoResult) { - case TaikoScoreResult.Good: + case TaikoHitResult.Good: judgementColour = colours.Green; judgementText = "GOOD"; textContainer.Scale = new Vector2(0.45f); break; - case TaikoScoreResult.Great: + case TaikoHitResult.Great: judgementColour = colours.Blue; judgementText = "GREAT"; break; diff --git a/osu.Game.Modes.Taiko/UI/RingExplosion.cs b/osu.Game.Modes.Taiko/UI/RingExplosion.cs index e405fa0bfb..6400b0d573 100644 --- a/osu.Game.Modes.Taiko/UI/RingExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/RingExplosion.cs @@ -55,12 +55,12 @@ namespace osu.Game.Modes.Taiko.UI if (Judgement.SecondHit) Size *= 1.5f; - switch (Judgement.Score) + switch (Judgement.TaikoResult) { - case TaikoScoreResult.Good: + case TaikoHitResult.Good: innerFill.Colour = colours.Green; break; - case TaikoScoreResult.Great: + case TaikoHitResult.Great: innerFill.Colour = colours.Blue; break; } From 8f6cee2544bea606786a69c13cc8a89ecf74027f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 22 Mar 2017 01:43:20 +0900 Subject: [PATCH 16/33] Override is unnecessary. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 488b2f192e..9c0673b527 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -72,11 +72,6 @@ namespace osu.Desktop.VisualTests.Tests protected override void UpdateState(ArmedState state) { } - - protected override void Update() - { - // Doesn't move - } } } } From 9c325ddd33904828c40b2c80d393fc469e1165ac Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 09:12:51 +0900 Subject: [PATCH 17/33] Cleanups + fix CircularContainer usages. --- osu.Game.Modes.Taiko/UI/HitTarget.cs | 20 ++------------------ osu.Game.Modes.Taiko/UI/InputDrum.cs | 15 --------------- osu.Game.Modes.Taiko/UI/JudgementText.cs | 8 -------- osu.Game.Modes.Taiko/UI/RingExplosion.cs | 1 + 4 files changed, 3 insertions(+), 41 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs index 9f20e1da0c..cc332abb8d 100644 --- a/osu.Game.Modes.Taiko/UI/HitTarget.cs +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -39,35 +39,27 @@ namespace osu.Game.Modes.Taiko.UI new Box { Name = "Bar Upper", - Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Y = border_offset, - Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f - border_offset), - Alpha = 0.1f }, new CircularContainer { Name = "Finisher Ring", - Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(finisher_diameter), - + Masking = true, BorderColour = Color4.White, BorderThickness = 2, Alpha = 0.1f, - Children = new[] { new Box { RelativeSizeAxes = Axes.Both, - Alpha = 0, AlwaysPresent = true } @@ -76,22 +68,18 @@ namespace osu.Game.Modes.Taiko.UI new CircularContainer { Name = "Normal Ring", - Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(normal_diameter), - + Masking = true, BorderColour = Color4.White, BorderThickness = 2, Alpha = 0.5f, - Children = new[] { new Box { RelativeSizeAxes = Axes.Both, - Alpha = 0, AlwaysPresent = true } @@ -100,14 +88,10 @@ namespace osu.Game.Modes.Taiko.UI new Box { Name = "Bar Lower", - Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Y = -border_offset, - Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f - border_offset), - Alpha = 0.1f }, }; diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs index 607fd205bb..b763b53aa2 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -29,25 +29,18 @@ namespace osu.Game.Modes.Taiko.UI new TaikoHalfDrum(false) { Name = "Left Half", - Anchor = Anchor.Centre, Origin = Anchor.CentreRight, - RelativeSizeAxes = Axes.Both, - Keys = new List(new[] { Key.F, Key.D }) }, new TaikoHalfDrum(true) { Name = "Right Half", - Anchor = Anchor.Centre, Origin = Anchor.CentreLeft, - RelativeSizeAxes = Axes.Both, - Position = new Vector2(-1f, 0), - Keys = new List(new[] { Key.J, Key.K }) } }; @@ -81,25 +74,20 @@ namespace osu.Game.Modes.Taiko.UI { Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both }, outerHit = new Sprite { Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Alpha = 0, - BlendingMode = BlendingMode.Additive }, inner = new Sprite { Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, Size = new Vector2(0.7f) }, @@ -107,12 +95,9 @@ namespace osu.Game.Modes.Taiko.UI { Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, Size = new Vector2(0.7f), - Alpha = 0, - BlendingMode = BlendingMode.Additive } }; diff --git a/osu.Game.Modes.Taiko/UI/JudgementText.cs b/osu.Game.Modes.Taiko/UI/JudgementText.cs index 5156020931..8d86e880d6 100644 --- a/osu.Game.Modes.Taiko/UI/JudgementText.cs +++ b/osu.Game.Modes.Taiko/UI/JudgementText.cs @@ -40,31 +40,24 @@ namespace osu.Game.Modes.Taiko.UI { Anchor = Anchor.Centre, Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, - Children = new Drawable[] { new BufferedContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, - BlurSigma = new Vector2(10), CacheDrawnFrameBuffer = true, - RelativeSizeAxes = Axes.Both, Size = new Vector2(3), - BlendingMode = BlendingMode.Additive, - Children = new[] { glowText = new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = "Venera", TextSize = 22f, } @@ -74,7 +67,6 @@ namespace osu.Game.Modes.Taiko.UI { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = "Venera", TextSize = 22f, } diff --git a/osu.Game.Modes.Taiko/UI/RingExplosion.cs b/osu.Game.Modes.Taiko/UI/RingExplosion.cs index 6400b0d573..2bc1d2d3eb 100644 --- a/osu.Game.Modes.Taiko/UI/RingExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/RingExplosion.cs @@ -39,6 +39,7 @@ namespace osu.Game.Modes.Taiko.UI BorderThickness = 1; Alpha = 0.15f; + Masking = true; Children = new[] { From 8b71d70633292c97c6a2d75e3697709a0d23035d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 12:21:09 +0900 Subject: [PATCH 18/33] Add a way to get the score string from JugementInfo. --- .../Judgements/CatchJudgementInfo.cs | 3 +++ .../Judgements/ManiaJudgementInfo.cs | 3 +++ .../Judgements/OsuJudgementInfo.cs | 5 ++++ .../Judgements/TaikoHitResult.cs | 4 +++ .../Judgements/TaikoJudgementInfo.cs | 5 ++++ osu.Game/Modes/Judgements/JudgementInfo.cs | 25 +++++++++++++++++-- 6 files changed, 43 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Catch/Judgements/CatchJudgementInfo.cs b/osu.Game.Modes.Catch/Judgements/CatchJudgementInfo.cs index 33e84d2f97..53e0c6c0bf 100644 --- a/osu.Game.Modes.Catch/Judgements/CatchJudgementInfo.cs +++ b/osu.Game.Modes.Catch/Judgements/CatchJudgementInfo.cs @@ -7,5 +7,8 @@ namespace osu.Game.Modes.Catch.Judgements { public class CatchJudgementInfo : JudgementInfo { + public override string ScoreString => string.Empty; + + public override string MaxScoreString => string.Empty; } } diff --git a/osu.Game.Modes.Mania/Judgements/ManiaJudgementInfo.cs b/osu.Game.Modes.Mania/Judgements/ManiaJudgementInfo.cs index a75f95abe7..c65bd87b6b 100644 --- a/osu.Game.Modes.Mania/Judgements/ManiaJudgementInfo.cs +++ b/osu.Game.Modes.Mania/Judgements/ManiaJudgementInfo.cs @@ -7,5 +7,8 @@ namespace osu.Game.Modes.Mania.Judgements { public class ManiaJudgementInfo : JudgementInfo { + public override string ScoreString => string.Empty; + + public override string MaxScoreString => string.Empty; } } diff --git a/osu.Game.Modes.Osu/Judgements/OsuJudgementInfo.cs b/osu.Game.Modes.Osu/Judgements/OsuJudgementInfo.cs index 20d36efe55..b945bad8a1 100644 --- a/osu.Game.Modes.Osu/Judgements/OsuJudgementInfo.cs +++ b/osu.Game.Modes.Osu/Judgements/OsuJudgementInfo.cs @@ -4,6 +4,7 @@ using OpenTK; using osu.Game.Modes.Judgements; using osu.Game.Modes.Osu.Objects.Drawables; +using osu.Framework.Extensions; namespace osu.Game.Modes.Osu.Judgements { @@ -24,6 +25,10 @@ namespace osu.Game.Modes.Osu.Judgements /// public OsuScoreResult MaxScore = OsuScoreResult.Hit300; + public override string ScoreString => Score.GetDescription(); + + public override string MaxScoreString => MaxScore.GetDescription(); + public int ScoreValue => scoreToInt(Score); public int MaxScoreValue => scoreToInt(MaxScore); diff --git a/osu.Game.Modes.Taiko/Judgements/TaikoHitResult.cs b/osu.Game.Modes.Taiko/Judgements/TaikoHitResult.cs index d425616b66..cbc3919c4f 100644 --- a/osu.Game.Modes.Taiko/Judgements/TaikoHitResult.cs +++ b/osu.Game.Modes.Taiko/Judgements/TaikoHitResult.cs @@ -1,11 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.ComponentModel; + namespace osu.Game.Modes.Taiko.Judgements { public enum TaikoHitResult { + [Description("GOOD")] Good, + [Description("GREAT")] Great } } diff --git a/osu.Game.Modes.Taiko/Judgements/TaikoJudgementInfo.cs b/osu.Game.Modes.Taiko/Judgements/TaikoJudgementInfo.cs index d9e81d4d77..3312661e2a 100644 --- a/osu.Game.Modes.Taiko/Judgements/TaikoJudgementInfo.cs +++ b/osu.Game.Modes.Taiko/Judgements/TaikoJudgementInfo.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Modes.Judgements; +using osu.Framework.Extensions; namespace osu.Game.Modes.Taiko.Judgements { @@ -37,6 +38,10 @@ namespace osu.Game.Modes.Taiko.Judgements /// public int MaxAccuracyScoreValue => NumericResultForAccuracy(MAX_HIT_RESULT); + public override string ScoreString => TaikoResult.GetDescription(); + + public override string MaxScoreString => MAX_HIT_RESULT.GetDescription(); + /// /// Whether this Judgement has a secondary hit in the case of finishers. /// diff --git a/osu.Game/Modes/Judgements/JudgementInfo.cs b/osu.Game/Modes/Judgements/JudgementInfo.cs index 8e7539134e..a3cb9ba51f 100644 --- a/osu.Game/Modes/Judgements/JudgementInfo.cs +++ b/osu.Game/Modes/Judgements/JudgementInfo.cs @@ -5,10 +5,31 @@ using osu.Game.Modes.Objects.Drawables; namespace osu.Game.Modes.Judgements { - public class JudgementInfo + public abstract class JudgementInfo { - public ulong? ComboAtHit; + /// + /// Whether this judgement is the result of a hit or a miss. + /// public HitResult? Result; + + /// + /// The offset at which this judgement occurred. + /// public double TimeOffset; + + /// + /// The combo after this judgement was processed. + /// + public ulong? ComboAtHit; + + /// + /// The string representation for the score achieved. + /// + public abstract string ScoreString { get; } + + /// + /// The string representation for the max score achievable. + /// + public abstract string MaxScoreString { get; } } } \ No newline at end of file From c9fe9e681d561d4a47e118668f29a1e30f8b6b5c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 12:49:28 +0900 Subject: [PATCH 19/33] Make judgement text generic to be used between game modes. --- .../Objects/Drawables/HitExplosion.cs | 66 ++------------ osu.Game.Modes.Osu/UI/OsuPlayfield.cs | 6 +- .../Modes/Judgements/DrawableJudgementInfo.cs | 86 +++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 4 files changed, 98 insertions(+), 61 deletions(-) create mode 100644 osu.Game/Modes/Judgements/DrawableJudgementInfo.cs diff --git a/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs b/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs index ab34d49ecf..ddc394f57f 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs @@ -1,85 +1,31 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; -using osu.Game.Graphics.Sprites; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Osu.Judgements; using OpenTK; -using OpenTK.Graphics; +using osu.Game.Modes.Judgements; namespace osu.Game.Modes.Osu.Objects.Drawables { - public class HitExplosion : FillFlowContainer + public class HitExplosion : DrawableJudgementInfo { - private readonly OsuJudgementInfo judgement; - private SpriteText line1; - private SpriteText line2; - - public HitExplosion(OsuJudgementInfo judgement, OsuHitObject h = null) + public HitExplosion(OsuJudgementInfo judgement) + : base(judgement) { - this.judgement = judgement; - AutoSizeAxes = Axes.Both; - Origin = Anchor.Centre; - - Direction = FillDirection.Vertical; - Spacing = new Vector2(0, 2); - Position = (h?.StackedEndPosition ?? Vector2.Zero) + judgement.PositionOffset; - - Children = new Drawable[] - { - line1 = new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Text = judgement.Score.GetDescription(), - Font = @"Venera", - TextSize = 16, - }, - line2 = new OsuSpriteText - { - Text = judgement.Combo.GetDescription(), - Font = @"Venera", - TextSize = 11, - } - }; } protected override void LoadComplete() { base.LoadComplete(); - if (judgement.Result == HitResult.Miss) + if (Judgement.Result != HitResult.Miss) { - FadeInFromZero(60); - - ScaleTo(1.6f); - ScaleTo(1, 100, EasingTypes.In); - - MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint); - RotateTo(40, 800, EasingTypes.InQuint); - - Delay(600); - FadeOut(200); - } - else - { - line1.TransformSpacingTo(new Vector2(14, 0), 1800, EasingTypes.OutQuint); - line2.TransformSpacingTo(new Vector2(14, 0), 1800, EasingTypes.OutQuint); + JudgementText.TransformSpacingTo(new Vector2(14, 0), 1800, EasingTypes.OutQuint); FadeOut(500); } - switch (judgement.Result) - { - case HitResult.Miss: - Colour = Color4.Red; - break; - } - Expire(); } } diff --git a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs index 5caaaafb13..bd9b4982eb 100644 --- a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs @@ -85,7 +85,11 @@ namespace osu.Game.Modes.Osu.UI public override void OnJudgement(DrawableHitObject judgedObject) { - HitExplosion explosion = new HitExplosion(judgedObject.Judgement, judgedObject.HitObject); + HitExplosion explosion = new HitExplosion(judgedObject.Judgement) + { + Origin = Anchor.Centre, + Position = judgedObject.HitObject.StackedEndPosition + judgedObject.Judgement.PositionOffset + }; judgementLayer.Add(explosion); } diff --git a/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs b/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs new file mode 100644 index 0000000000..fb85e20da0 --- /dev/null +++ b/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs @@ -0,0 +1,86 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// 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.Extensions; +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.Graphics.Sprites; +using osu.Game.Modes.Objects.Drawables; + +namespace osu.Game.Modes.Judgements +{ + /// + /// A drawable object which visualises the hit result of a . + /// + /// The type of judgement to visualise. + public class DrawableJudgementInfo : Container + where TJudgement : JudgementInfo + { + protected readonly TJudgement Judgement; + + protected readonly SpriteText JudgementText; + + /// + /// Creates a drawable which visualises a . + /// + /// The judgement to visualise. + public DrawableJudgementInfo(TJudgement judgement) + { + Judgement = judgement; + + AutoSizeAxes = Axes.Both; + + string scoreString = judgement.Result == HitResult.Hit ? judgement.ScoreString : judgement.Result.GetDescription(); + + Children = new[] + { + JudgementText = new OsuSpriteText + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Text = scoreString.ToUpper(), + Font = @"Venera", + TextSize = 16 + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + switch (Judgement.Result) + { + case HitResult.Miss: + Colour = colours.Red; + break; + } + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + if (Judgement.Result == HitResult.Miss) + { + FadeInFromZero(60); + + ScaleTo(1.6f); + ScaleTo(1, 100, EasingTypes.In); + + MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint); + RotateTo(40, 800, EasingTypes.InQuint); + + Delay(600); + FadeOut(200); + } + + Expire(); + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index bfb787cd51..164c8c7ec1 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -96,6 +96,7 @@ + From 39ff026b2787519466633f915a90644fc56f6934 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 12:49:58 +0900 Subject: [PATCH 20/33] Reimplement JudgementText with the new DrawableJudgementInfo. --- osu.Game.Modes.Taiko/UI/JudgementText.cs | 90 ++++------------------- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 4 +- 2 files changed, 15 insertions(+), 79 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/JudgementText.cs b/osu.Game.Modes.Taiko/UI/JudgementText.cs index 8d86e880d6..ae7bd6b596 100644 --- a/osu.Game.Modes.Taiko/UI/JudgementText.cs +++ b/osu.Game.Modes.Taiko/UI/JudgementText.cs @@ -11,115 +11,53 @@ using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Objects.Drawables; using osu.Framework.Allocation; using osu.Game.Graphics; +using osu.Game.Modes.Judgements; namespace osu.Game.Modes.Taiko.UI { /// /// Text that is shown as judgement when a hit object is hit or missed. /// - public class JudgementText : Container + public class JudgementText : DrawableJudgementInfo { /// - /// The Judgement to display. + /// Creates a new judgement text. /// - public TaikoJudgementInfo Judgement; - - private Container textContainer; - private OsuSpriteText glowText; - private OsuSpriteText normalText; - - private int movementDirection; - - public JudgementText() + /// The judgement to visualise. + public JudgementText(TaikoJudgementInfo judgement) + : base(judgement) { - AutoSizeAxes = Axes.Both; - - Children = new Drawable[] - { - textContainer = new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, - Children = new Drawable[] - { - new BufferedContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - BlurSigma = new Vector2(10), - CacheDrawnFrameBuffer = true, - RelativeSizeAxes = Axes.Both, - Size = new Vector2(3), - BlendingMode = BlendingMode.Additive, - Children = new[] - { - glowText = new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Font = "Venera", - TextSize = 22f, - } - } - }, - normalText = new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Font = "Venera", - TextSize = 22f, - } - } - } - }; } [BackgroundDependencyLoader] private void load(OsuColour colours) { - Color4 judgementColour = Color4.White; - string judgementText = string.Empty; - switch (Judgement.Result) { - case HitResult.Miss: - judgementColour = colours.Red; - judgementText = "MISS"; - movementDirection = 1; - break; case HitResult.Hit: switch (Judgement.TaikoResult) { case TaikoHitResult.Good: - judgementColour = colours.Green; - judgementText = "GOOD"; - textContainer.Scale = new Vector2(0.45f); + Colour = colours.Green; break; case TaikoHitResult.Great: - judgementColour = colours.Blue; - judgementText = "GREAT"; + Colour = colours.Blue; break; } - - movementDirection = -1; break; } - - glowText.Colour = judgementColour; - glowText.Text = normalText.Text = judgementText; } protected override void LoadComplete() { base.LoadComplete(); - ScaleTo(1.5f, 250, EasingTypes.OutQuint); - MoveToY(movementDirection * 100, 500); - - Delay(250); - ScaleTo(0.75f, 250); - FadeOut(250); + if (Judgement.Result == HitResult.Hit) + { + MoveToY(-100, 500); + Delay(250); + FadeOut(250); + } Expire(); } diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index b2248e2c3e..d93f45cc3b 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -192,15 +192,13 @@ namespace osu.Game.Modes.Taiko.UI float judgementOffset = judgedObject.Judgement.Result == HitResult.Hit ? judgedObject.Position.X : 0; - judgementContainer.Add(new JudgementText + judgementContainer.Add(new JudgementText(judgedObject.Judgement) { Anchor = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.TopLeft : Anchor.BottomLeft, Origin = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.BottomCentre : Anchor.TopCentre, RelativePositionAxes = Axes.X, X = judgementOffset, - - Judgement = judgedObject.Judgement }); } } From 7f33e10db07ec893051d512b4153f4f53ec13ea0 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 12:53:38 +0900 Subject: [PATCH 21/33] Renaming + don't use List. --- osu.Game.Modes.Taiko/UI/InputDrum.cs | 58 +++++++++++++++------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs index b763b53aa2..e69ae68e03 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -32,7 +32,8 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.Centre, Origin = Anchor.CentreRight, RelativeSizeAxes = Axes.Both, - Keys = new List(new[] { Key.F, Key.D }) + RimKey = Key.D, + CentreKey = Key.F }, new TaikoHalfDrum(true) { @@ -41,7 +42,8 @@ namespace osu.Game.Modes.Taiko.UI Origin = Anchor.CentreLeft, RelativeSizeAxes = Axes.Both, Position = new Vector2(-1f, 0), - Keys = new List(new[] { Key.J, Key.K }) + RimKey = Key.K, + CentreKey = Key.J } }; } @@ -52,17 +54,19 @@ namespace osu.Game.Modes.Taiko.UI private class TaikoHalfDrum : Container { /// - /// A list of keys which this half-drum accepts. - /// - /// [0] => Inner key, [1] => Outer key - /// + /// The key to be used for the rim of the half-drum. /// - public List Keys = new List(); + public Key RimKey; + + /// + /// The key to be used for the centre of the half-drum. + /// + public Key CentreKey; - private Sprite outer; - private Sprite outerHit; - private Sprite inner; - private Sprite innerHit; + private Sprite rim; + private Sprite rimHit; + private Sprite centre; + private Sprite centreHit; public TaikoHalfDrum(bool flipped) { @@ -70,13 +74,13 @@ namespace osu.Game.Modes.Taiko.UI Children = new Drawable[] { - outer = new Sprite + rim = new Sprite { Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both }, - outerHit = new Sprite + rimHit = new Sprite { Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, Origin = Anchor.Centre, @@ -84,14 +88,14 @@ namespace osu.Game.Modes.Taiko.UI Alpha = 0, BlendingMode = BlendingMode.Additive }, - inner = new Sprite + centre = new Sprite { Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Size = new Vector2(0.7f) }, - innerHit = new Sprite + centreHit = new Sprite { Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, Origin = Anchor.Centre, @@ -106,13 +110,13 @@ namespace osu.Game.Modes.Taiko.UI [BackgroundDependencyLoader] private void load(TextureStore textures, OsuColour colours) { - outer.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer"); - outerHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer-hit"); - inner.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner"); - innerHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner-hit"); + rim.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer"); + rimHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer-hit"); + centre.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner"); + centreHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner-hit"); - outerHit.Colour = colours.Blue; - innerHit.Colour = colours.Pink; + rimHit.Colour = colours.Blue; + centreHit.Colour = colours.Pink; } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) @@ -120,16 +124,16 @@ namespace osu.Game.Modes.Taiko.UI if (args.Repeat) return false; - if (args.Key == Keys[0]) + if (args.Key == CentreKey) { - innerHit.FadeIn(); - innerHit.FadeOut(500, EasingTypes.OutQuint); + centreHit.FadeIn(); + centreHit.FadeOut(500, EasingTypes.OutQuint); } - if (args.Key == Keys[1]) + if (args.Key == RimKey) { - outerHit.FadeIn(); - outerHit.FadeOut(500, EasingTypes.OutQuint); + rimHit.FadeIn(); + rimHit.FadeOut(500, EasingTypes.OutQuint); } return false; From 00054f15737fe4ce0b68acaa9be202e728af2bc1 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 12:56:32 +0900 Subject: [PATCH 22/33] Comment out unused container for now. --- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index d93f45cc3b..38100df38d 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -51,8 +51,7 @@ namespace osu.Game.Modes.Taiko.UI private Container judgementContainer; private Container hitObjectContainer; - // ReSharper disable once NotAccessedField.Local - private Container topLevelHitContainer; + //private Container topLevelHitContainer; private Container leftBackgroundContainer; private Container rightBackgroundContainer; private Box leftBackground; @@ -156,10 +155,10 @@ namespace osu.Game.Modes.Taiko.UI }, } }, - topLevelHitContainer = new Container - { - RelativeSizeAxes = Axes.Both, - } + //topLevelHitContainer = new Container + //{ + // RelativeSizeAxes = Axes.Both, + //} }); } From cedcab1e2651a971f20a05ccb6d791f00ebcea70 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 13:02:01 +0900 Subject: [PATCH 23/33] s/Ring/Hit + privatize Judgement inside RingExplosion. --- .../UI/{RingExplosion.cs => HitExplosion.cs} | 18 ++++++++---------- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 9 +++------ .../osu.Game.Modes.Taiko.csproj | 2 +- 3 files changed, 12 insertions(+), 17 deletions(-) rename osu.Game.Modes.Taiko/UI/{RingExplosion.cs => HitExplosion.cs} (79%) diff --git a/osu.Game.Modes.Taiko/UI/RingExplosion.cs b/osu.Game.Modes.Taiko/UI/HitExplosion.cs similarity index 79% rename from osu.Game.Modes.Taiko/UI/RingExplosion.cs rename to osu.Game.Modes.Taiko/UI/HitExplosion.cs index 2bc1d2d3eb..c3059ef713 100644 --- a/osu.Game.Modes.Taiko/UI/RingExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/HitExplosion.cs @@ -15,19 +15,17 @@ using osu.Game.Modes.Taiko.Objects; namespace osu.Game.Modes.Taiko.UI { /// - /// A ring that explodes to indicate a judgement has occurred. + /// A circle explodes from the hit target to indicate a hitobject has been hit. /// - internal class RingExplosion : CircularContainer + internal class HitExplosion : CircularContainer { - /// - /// The Judgement to display. - /// - public TaikoJudgementInfo Judgement; - + private TaikoJudgementInfo judgement; private Box innerFill; - public RingExplosion() + public HitExplosion(TaikoJudgementInfo judgement) { + this.judgement = judgement; + Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2); Anchor = Anchor.Centre; @@ -53,10 +51,10 @@ namespace osu.Game.Modes.Taiko.UI [BackgroundDependencyLoader] private void load(OsuColour colours) { - if (Judgement.SecondHit) + if (judgement.SecondHit) Size *= 1.5f; - switch (Judgement.TaikoResult) + switch (judgement.TaikoResult) { case TaikoHitResult.Good: innerFill.Colour = colours.Green; diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 38100df38d..77fe511108 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -46,7 +46,7 @@ namespace osu.Game.Modes.Taiko.UI protected override Container Content => hitObjectContainer; - private Container ringExplosionContainer; + private Container hitExplosionContainer; //private Container barLineContainer; private Container judgementContainer; @@ -96,7 +96,7 @@ namespace osu.Game.Modes.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - ringExplosionContainer = new Container + hitExplosionContainer = new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, @@ -183,10 +183,7 @@ namespace osu.Game.Modes.Taiko.UI { if (judgedObject.Judgement.Result == HitResult.Hit) { - ringExplosionContainer.Add(new RingExplosion - { - Judgement = judgedObject.Judgement - }); + hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement)); } float judgementOffset = judgedObject.Judgement.Result == HitResult.Hit ? judgedObject.Position.X : 0; diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 2bd9ddc327..6c97ed3391 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -62,7 +62,7 @@ - + From aa2b22ff1222356d02f58765916f92f08639332f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 13:02:34 +0900 Subject: [PATCH 24/33] Fix usings. --- osu.Game.Modes.Taiko/UI/InputDrum.cs | 1 - osu.Game.Modes.Taiko/UI/JudgementText.cs | 6 ------ osu.Game/Modes/Judgements/DrawableJudgementInfo.cs | 1 - 3 files changed, 8 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs index e69ae68e03..580b67a03d 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics; -using System.Collections.Generic; namespace osu.Game.Modes.Taiko.UI { diff --git a/osu.Game.Modes.Taiko/UI/JudgementText.cs b/osu.Game.Modes.Taiko/UI/JudgementText.cs index ae7bd6b596..06368d6d2c 100644 --- a/osu.Game.Modes.Taiko/UI/JudgementText.cs +++ b/osu.Game.Modes.Taiko/UI/JudgementText.cs @@ -1,12 +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.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Transforms; -using osu.Game.Graphics.Sprites; -using OpenTK; -using OpenTK.Graphics; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Objects.Drawables; using osu.Framework.Allocation; diff --git a/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs b/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs index fb85e20da0..0eadec42d8 100644 --- a/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs +++ b/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs @@ -2,7 +2,6 @@ // 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.Extensions; using osu.Framework.Graphics; From 8e1eef25b4bffd9af63fa14ecb879df2e8180774 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 13:20:17 +0900 Subject: [PATCH 25/33] Fix some lone newlines. --- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 77fe511108..0ab31606eb 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -140,10 +140,8 @@ namespace osu.Game.Modes.Taiko.UI { Anchor = Anchor.Centre, Origin = Anchor.Centre, - RelativePositionAxes = Axes.X, Position = new Vector2(0.10f, 0), - Scale = new Vector2(0.9f) }, new Box @@ -192,7 +190,6 @@ namespace osu.Game.Modes.Taiko.UI { Anchor = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.TopLeft : Anchor.BottomLeft, Origin = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.BottomCentre : Anchor.TopCentre, - RelativePositionAxes = Axes.X, X = judgementOffset, }); From 9a3fd8bcf1cc85a53ab5d363e2fedf69f69b46bb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 14:37:00 +0900 Subject: [PATCH 26/33] Add readonly attributes. --- osu.Game.Modes.Taiko/UI/HitExplosion.cs | 4 ++-- osu.Game.Modes.Taiko/UI/InputDrum.cs | 8 ++++---- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/HitExplosion.cs b/osu.Game.Modes.Taiko/UI/HitExplosion.cs index c3059ef713..3aa7977617 100644 --- a/osu.Game.Modes.Taiko/UI/HitExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/HitExplosion.cs @@ -19,8 +19,8 @@ namespace osu.Game.Modes.Taiko.UI /// internal class HitExplosion : CircularContainer { - private TaikoJudgementInfo judgement; - private Box innerFill; + private readonly TaikoJudgementInfo judgement; + private readonly Box innerFill; public HitExplosion(TaikoJudgementInfo judgement) { diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs index 580b67a03d..7582495145 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -62,10 +62,10 @@ namespace osu.Game.Modes.Taiko.UI /// public Key CentreKey; - private Sprite rim; - private Sprite rimHit; - private Sprite centre; - private Sprite centreHit; + private readonly Sprite rim; + private readonly Sprite rimHit; + private readonly Sprite centre; + private readonly Sprite centreHit; public TaikoHalfDrum(bool flipped) { diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 0ab31606eb..c92a2ae702 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -46,16 +46,16 @@ namespace osu.Game.Modes.Taiko.UI protected override Container Content => hitObjectContainer; - private Container hitExplosionContainer; + private readonly Container hitExplosionContainer; //private Container barLineContainer; - private Container judgementContainer; + private readonly Container judgementContainer; - private Container hitObjectContainer; + private readonly Container hitObjectContainer; //private Container topLevelHitContainer; - private Container leftBackgroundContainer; - private Container rightBackgroundContainer; - private Box leftBackground; - private Box rightBackground; + private readonly Container leftBackgroundContainer; + private readonly Container rightBackgroundContainer; + private readonly Box leftBackground; + private readonly Box rightBackground; public TaikoPlayfield() { From acfa4a4aac01802101ce6af487ada902f61e7493 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 14:52:18 +0900 Subject: [PATCH 27/33] JudgementText -> DrawableTaikoJudgementInfo. --- .../{JudgementText.cs => DrawableTaikoJudgementInfo.cs} | 8 ++++---- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 6 +++--- osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) rename osu.Game.Modes.Taiko/UI/{JudgementText.cs => DrawableTaikoJudgementInfo.cs} (81%) diff --git a/osu.Game.Modes.Taiko/UI/JudgementText.cs b/osu.Game.Modes.Taiko/UI/DrawableTaikoJudgementInfo.cs similarity index 81% rename from osu.Game.Modes.Taiko/UI/JudgementText.cs rename to osu.Game.Modes.Taiko/UI/DrawableTaikoJudgementInfo.cs index 06368d6d2c..bb2935b528 100644 --- a/osu.Game.Modes.Taiko/UI/JudgementText.cs +++ b/osu.Game.Modes.Taiko/UI/DrawableTaikoJudgementInfo.cs @@ -12,13 +12,13 @@ namespace osu.Game.Modes.Taiko.UI /// /// Text that is shown as judgement when a hit object is hit or missed. /// - public class JudgementText : DrawableJudgementInfo + public class DrawableTaikoJudgementInfo : DrawableJudgementInfo { /// /// Creates a new judgement text. /// /// The judgement to visualise. - public JudgementText(TaikoJudgementInfo judgement) + public DrawableTaikoJudgementInfo(TaikoJudgementInfo judgement) : base(judgement) { } @@ -32,10 +32,10 @@ namespace osu.Game.Modes.Taiko.UI switch (Judgement.TaikoResult) { case TaikoHitResult.Good: - Colour = colours.Green; + Colour = colours.GreenLight; break; case TaikoHitResult.Great: - Colour = colours.Blue; + Colour = colours.BlueLight; break; } break; diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index c92a2ae702..0ae6fd2c7b 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -48,7 +48,7 @@ namespace osu.Game.Modes.Taiko.UI private readonly Container hitExplosionContainer; //private Container barLineContainer; - private readonly Container judgementContainer; + private readonly Container judgementContainer; private readonly Container hitObjectContainer; //private Container topLevelHitContainer; @@ -117,7 +117,7 @@ namespace osu.Game.Modes.Taiko.UI { RelativeSizeAxes = Axes.Both, }, - judgementContainer = new Container + judgementContainer = new Container { RelativeSizeAxes = Axes.Both, BlendingMode = BlendingMode.Additive @@ -186,7 +186,7 @@ namespace osu.Game.Modes.Taiko.UI float judgementOffset = judgedObject.Judgement.Result == HitResult.Hit ? judgedObject.Position.X : 0; - judgementContainer.Add(new JudgementText(judgedObject.Judgement) + judgementContainer.Add(new DrawableTaikoJudgementInfo(judgedObject.Judgement) { Anchor = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.TopLeft : Anchor.BottomLeft, Origin = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.BottomCentre : Anchor.TopCentre, diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 6c97ed3391..3534f06f92 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -61,7 +61,7 @@ - + From 02fba000bc27355ea901a51cef0527072bbd19a0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 15:07:45 +0900 Subject: [PATCH 28/33] Tidy up and tweak transitions of DrawableJudgementInfo. --- .../UI/DrawableTaikoJudgementInfo.cs | 12 ++++----- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 14 +++++----- .../Modes/Judgements/DrawableJudgementInfo.cs | 27 +++++++++++++------ 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/DrawableTaikoJudgementInfo.cs b/osu.Game.Modes.Taiko/UI/DrawableTaikoJudgementInfo.cs index bb2935b528..87f321d557 100644 --- a/osu.Game.Modes.Taiko/UI/DrawableTaikoJudgementInfo.cs +++ b/osu.Game.Modes.Taiko/UI/DrawableTaikoJudgementInfo.cs @@ -44,16 +44,14 @@ namespace osu.Game.Modes.Taiko.UI protected override void LoadComplete() { - base.LoadComplete(); - - if (Judgement.Result == HitResult.Hit) + switch (Judgement.Result) { - MoveToY(-100, 500); - Delay(250); - FadeOut(250); + case HitResult.Hit: + MoveToY(-100, 500); + break; } - Expire(); + base.LoadComplete(); } } } \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 0ae6fd2c7b..b322e167df 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -179,19 +179,17 @@ namespace osu.Game.Modes.Taiko.UI public override void OnJudgement(DrawableHitObject judgedObject) { - if (judgedObject.Judgement.Result == HitResult.Hit) - { - hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement)); - } + bool wasHit = judgedObject.Judgement.Result == HitResult.Hit; - float judgementOffset = judgedObject.Judgement.Result == HitResult.Hit ? judgedObject.Position.X : 0; + if (wasHit) + hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement)); judgementContainer.Add(new DrawableTaikoJudgementInfo(judgedObject.Judgement) { - Anchor = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.TopLeft : Anchor.BottomLeft, - Origin = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.BottomCentre : Anchor.TopCentre, + Anchor = wasHit ? Anchor.TopLeft : Anchor.CentreLeft, + Origin = wasHit ? Anchor.BottomCentre : Anchor.Centre, RelativePositionAxes = Axes.X, - X = judgementOffset, + X = wasHit ? judgedObject.Position.X : 0, }); } } diff --git a/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs b/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs index 0eadec42d8..6cf85fa372 100644 --- a/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs +++ b/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs @@ -25,6 +25,8 @@ namespace osu.Game.Modes.Judgements protected readonly SpriteText JudgementText; + protected double HitVisibleLength => 600; + /// /// Creates a drawable which visualises a . /// @@ -65,18 +67,27 @@ namespace osu.Game.Modes.Judgements { base.LoadComplete(); - if (Judgement.Result == HitResult.Miss) + FadeInFromZero(100, EasingTypes.OutQuint); + + switch (Judgement.Result) { - FadeInFromZero(60); + case HitResult.Miss: + ScaleTo(1.6f); + ScaleTo(1, 100, EasingTypes.In); - ScaleTo(1.6f); - ScaleTo(1, 100, EasingTypes.In); + MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint); + RotateTo(40, 800, EasingTypes.InQuint); - MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint); - RotateTo(40, 800, EasingTypes.InQuint); + Delay(600); + FadeOut(200); + break; + case HitResult.Hit: + ScaleTo(0.9f); + ScaleTo(1, 500, EasingTypes.OutElastic); - Delay(600); - FadeOut(200); + Delay(250); + FadeOut(250, EasingTypes.OutQuint); + break; } Expire(); From b83db185513cc4066dd387993078f2af00ec8861 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 15:11:22 +0900 Subject: [PATCH 29/33] HitExplosion -> DrawableOsuJudgementInfo. --- .../{HitExplosion.cs => DrawableOsuJudgementInfo.cs} | 4 ++-- osu.Game.Modes.Osu/UI/OsuPlayfield.cs | 2 +- osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename osu.Game.Modes.Osu/Objects/Drawables/{HitExplosion.cs => DrawableOsuJudgementInfo.cs} (78%) diff --git a/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuJudgementInfo.cs similarity index 78% rename from osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs rename to osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuJudgementInfo.cs index 83f19bb96e..15832bcb75 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuJudgementInfo.cs @@ -9,9 +9,9 @@ using osu.Game.Modes.Judgements; namespace osu.Game.Modes.Osu.Objects.Drawables { - public class HitExplosion : DrawableJudgementInfo + public class DrawableOsuJudgementInfo : DrawableJudgementInfo { - public HitExplosion(OsuJudgementInfo judgement) : base(judgement) + public DrawableOsuJudgementInfo(OsuJudgementInfo judgement) : base(judgement) { } diff --git a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs index 6c1b759d63..8924fe71e7 100644 --- a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs @@ -85,7 +85,7 @@ namespace osu.Game.Modes.Osu.UI public override void OnJudgement(DrawableHitObject judgedObject) { - HitExplosion explosion = new HitExplosion(judgedObject.Judgement) + DrawableOsuJudgementInfo explosion = new DrawableOsuJudgementInfo(judgedObject.Judgement) { Origin = Anchor.Centre, Position = judgedObject.HitObject.StackedEndPosition + judgedObject.Judgement.PositionOffset diff --git a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj index 12135a38fb..1c1add8b94 100644 --- a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj +++ b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj @@ -58,7 +58,7 @@ - + From 1af17fc108c1d46df6345653b2d437bedbfedb91 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 15:12:08 +0900 Subject: [PATCH 30/33] Remove cross-reference to osu.Game.Modes.Osu from Taiko. --- osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 3534f06f92..74ed36fd6a 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -80,10 +80,6 @@ {C76BF5B3-985E-4D39-95FE-97C9C879B83A} osu.Framework - - {C92A607B-1FDD-4954-9F92-03FF547D9080} - osu.Game.Modes.Osu - {0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D} osu.Game From ef8830aa7fba1e1a79f7f18624b7d30534c7ecb3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 15:28:17 +0900 Subject: [PATCH 31/33] Adjust InputDrum's appearance a touch. --- osu.Game.Modes.Taiko/UI/InputDrum.cs | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs index 7582495145..1787670c7a 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.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 OpenTK; using OpenTK.Input; using osu.Framework.Allocation; @@ -23,6 +24,8 @@ namespace osu.Game.Modes.Taiko.UI { Size = new Vector2(TaikoPlayfield.PlayfieldHeight); + const float middle_split = 10; + Children = new Drawable[] { new TaikoHalfDrum(false) @@ -31,6 +34,7 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.Centre, Origin = Anchor.CentreRight, RelativeSizeAxes = Axes.Both, + X = -middle_split / 2, RimKey = Key.D, CentreKey = Key.F }, @@ -40,6 +44,7 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.Centre, Origin = Anchor.CentreLeft, RelativeSizeAxes = Axes.Both, + X = middle_split / 2, Position = new Vector2(-1f, 0), RimKey = Key.K, CentreKey = Key.J @@ -85,7 +90,7 @@ namespace osu.Game.Modes.Taiko.UI Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Alpha = 0, - BlendingMode = BlendingMode.Additive + BlendingMode = BlendingMode.Additive, }, centre = new Sprite { @@ -123,16 +128,18 @@ namespace osu.Game.Modes.Taiko.UI if (args.Repeat) return false; - if (args.Key == CentreKey) - { - centreHit.FadeIn(); - centreHit.FadeOut(500, EasingTypes.OutQuint); - } + Drawable target = null; - if (args.Key == RimKey) + if (args.Key == CentreKey) + target = centreHit; + else if (args.Key == RimKey) + target = rimHit; + + if (target != null) { - rimHit.FadeIn(); - rimHit.FadeOut(500, EasingTypes.OutQuint); + target.FadeTo(Math.Min(target.Alpha + 0.4f, 1), 40, EasingTypes.OutQuint); + target.Delay(40); + target.FadeOut(600, EasingTypes.OutQuint); } return false; From ebb64e01d14984adc534328894509220656fd687 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 15:32:41 +0900 Subject: [PATCH 32/33] Add constant for HitTarget line thickness and make slightly thicker (displays better at lower resolutions). --- osu.Game.Modes.Taiko/UI/HitTarget.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs index cc332abb8d..d38af3390e 100644 --- a/osu.Game.Modes.Taiko/UI/HitTarget.cs +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -30,6 +30,11 @@ namespace osu.Game.Modes.Taiko.UI /// private const float border_offset = 1; + /// + /// Thickness of all drawn line pieces. + /// + private const float border_thickness = 2.5f; + public HitTarget() { RelativeSizeAxes = Axes.Y; @@ -42,7 +47,7 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Y = border_offset, - Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f - border_offset), + Size = new Vector2(border_thickness, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f - border_offset), Alpha = 0.1f }, new CircularContainer @@ -53,7 +58,7 @@ namespace osu.Game.Modes.Taiko.UI Size = new Vector2(finisher_diameter), Masking = true, BorderColour = Color4.White, - BorderThickness = 2, + BorderThickness = border_thickness, Alpha = 0.1f, Children = new[] { @@ -73,7 +78,7 @@ namespace osu.Game.Modes.Taiko.UI Size = new Vector2(normal_diameter), Masking = true, BorderColour = Color4.White, - BorderThickness = 2, + BorderThickness = border_thickness, Alpha = 0.5f, Children = new[] { @@ -91,7 +96,7 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Y = -border_offset, - Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f - border_offset), + Size = new Vector2(border_thickness, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f - border_offset), Alpha = 0.1f }, }; From 0863efb2c8e7b73455234db158e27b0645a7c963 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 15:35:42 +0900 Subject: [PATCH 33/33] Remove unused variable. --- osu.Game/Modes/Judgements/DrawableJudgementInfo.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs b/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs index 6cf85fa372..85b357a995 100644 --- a/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs +++ b/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs @@ -25,8 +25,6 @@ namespace osu.Game.Modes.Judgements protected readonly SpriteText JudgementText; - protected double HitVisibleLength => 600; - /// /// Creates a drawable which visualises a . ///