From ccc2253068a669158cc8f9fcbc94f0d34ce42fd8 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 14:39:38 +0900 Subject: [PATCH 01/58] Implement basic Taiko HitObject conversion. --- .../Beatmaps/TaikoBeatmapConverter.cs | 49 ++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index d78c347f22..0fa7572cd4 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -2,8 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Legacy; +using osu.Game.Modes.Objects; +using osu.Game.Modes.Objects.Types; using osu.Game.Modes.Taiko.Objects; using System.Collections.Generic; +using System.Linq; namespace osu.Game.Modes.Taiko.Beatmaps { @@ -11,9 +15,52 @@ namespace osu.Game.Modes.Taiko.Beatmaps { public Beatmap Convert(Beatmap original) { + if (original is IIsLegacy) + original.TimingInfo.ControlPoints.ForEach(c => c.VelocityAdjustment *= 1.4); + return new Beatmap(original) { - HitObjects = new List() // Todo: Implement + HitObjects = convertHitObjects(original.HitObjects) + }; + } + + private List convertHitObjects(List hitObjects) + { + return hitObjects.Select(convertHitObject).ToList(); + } + + private TaikoHitObject convertHitObject(HitObject original) + { + IHasDistance distanceData = original as IHasDistance; + IHasRepeats repeatsData = original as IHasRepeats; + IHasEndTime endTimeData = original as IHasEndTime; + + if (distanceData != null) + { + return new DrumRoll + { + StartTime = original.StartTime, + Sample = original.Sample, + + Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) + }; + } + + if (endTimeData != null) + { + return new Bash + { + StartTime = original.StartTime, + Sample = original.Sample, + + EndTime = endTimeData.EndTime + }; + } + + return new TaikoHitObject + { + StartTime = original.StartTime, + Sample = original.Sample, }; } } From 4a85b899c9a9fdf9adbbcb0510adebd5134e1fd2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 14:44:48 +0900 Subject: [PATCH 02/58] Fix up VelocityAdjustment value. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 0fa7572cd4..e89ba110be 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -13,10 +13,12 @@ namespace osu.Game.Modes.Taiko.Beatmaps { internal class TaikoBeatmapConverter : IBeatmapConverter { + private const float legacy_velocity_scale = 1.4f; + public Beatmap Convert(Beatmap original) { if (original is IIsLegacy) - original.TimingInfo.ControlPoints.ForEach(c => c.VelocityAdjustment *= 1.4); + original.TimingInfo.ControlPoints.ForEach(c => c.VelocityAdjustment /= legacy_velocity_scale); return new Beatmap(original) { From 7f7e8047d4dcf4c6b9bdf6cb99580d2edaa8ed47 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:51:56 +0900 Subject: [PATCH 03/58] Don't convert originally taiko hitobjects. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index e89ba110be..6533295ce4 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -33,6 +33,11 @@ namespace osu.Game.Modes.Taiko.Beatmaps private TaikoHitObject convertHitObject(HitObject original) { + // Check if this HitObject is already a TaikoHitObject, and return it if so + TaikoHitObject originalTaiko = original as TaikoHitObject; + if (originalTaiko != null) + return originalTaiko; + IHasDistance distanceData = original as IHasDistance; IHasRepeats repeatsData = original as IHasRepeats; IHasEndTime endTimeData = original as IHasEndTime; From 605f733cf905f299050af7f0212662eb11e06c56 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:52:24 +0900 Subject: [PATCH 04/58] Add back the bash conversion factor. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 6533295ce4..00a17c017c 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -14,6 +14,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps internal class TaikoBeatmapConverter : IBeatmapConverter { private const float legacy_velocity_scale = 1.4f; + private const float bash_convert_factor = 1.65f; public Beatmap Convert(Beatmap original) { @@ -55,12 +56,13 @@ namespace osu.Game.Modes.Taiko.Beatmaps if (endTimeData != null) { + // We compute the end time manually to add in the Bash convert factor return new Bash { StartTime = original.StartTime, Sample = original.Sample, - EndTime = endTimeData.EndTime + EndTime = original.StartTime + endTimeData.Duration * bash_convert_factor }; } From 2a9e8f4ed6b98aa4ac8e3eb83751d022f5ede0cf Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:54:36 +0900 Subject: [PATCH 05/58] Fix license headers. --- osu.Game/Beatmaps/Legacy/IIsLegacy.cs | 5 ++++- osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Legacy/IIsLegacy.cs b/osu.Game/Beatmaps/Legacy/IIsLegacy.cs index 23ab9f4bc4..3babd3e66f 100644 --- a/osu.Game/Beatmaps/Legacy/IIsLegacy.cs +++ b/osu.Game/Beatmaps/Legacy/IIsLegacy.cs @@ -1,4 +1,7 @@ -namespace osu.Game.Beatmaps.Legacy +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Beatmaps.Legacy { /// /// A Beatmap that was loaded from a legacy .osu beatmap file (version <=15). diff --git a/osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs b/osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs index 00aeeb2b49..d0386e7560 100644 --- a/osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs +++ b/osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs @@ -1,4 +1,7 @@ -namespace osu.Game.Beatmaps.Legacy +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Beatmaps.Legacy { /// /// A type of Beatmap loaded from a legacy .osu beatmap file (version <=15). From 77bdfe880a54a00e53c3aa8f05a775f3f95b4489 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 18 Mar 2017 18:34:45 +0900 Subject: [PATCH 06/58] Fix post-merge errors. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 00a17c017c..06c0b6c994 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -18,7 +18,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps public Beatmap Convert(Beatmap original) { - if (original is IIsLegacy) + if (original is LegacyBeatmap) original.TimingInfo.ControlPoints.ForEach(c => c.VelocityAdjustment /= legacy_velocity_scale); return new Beatmap(original) From f4f571590658415d9dbe44e7a291040006427b46 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 18 Mar 2017 18:37:48 +0900 Subject: [PATCH 07/58] Resharper. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index 9ce2758d84..eebbb4717e 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Beatmaps; using osu.Game.Beatmaps.Samples; using osu.Game.Modes.Objects.Types; using System; @@ -68,7 +67,7 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - Velocity = (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) / 1000; + Velocity = timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier / 1000; TickTimeDistance = timing.BeatLengthAt(StartTime); if (difficulty.SliderTickRate == 3) From 58be4548ef34218bad1ba053f5808ad3fb7105fe Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 14:53:55 +0900 Subject: [PATCH 08/58] 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 09/58] 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 10/58] 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 11/58] 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 12/58] 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 13/58] 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 14/58] 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 15/58] 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 16/58] 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 17/58] 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 18/58] 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 19/58] 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 20/58] 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 21/58] 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 22/58] 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 23/58] 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 24/58] 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 db8bf8a78fbd8377a06f1197a80a7f8d6c055eed Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 11:21:45 +0900 Subject: [PATCH 25/58] Add Hit class, make TaikoHitObject abstract. --- osu.Game.Modes.Taiko/Objects/Hit.cs | 35 +++++++++++++++++++ .../Objects/TaikoHitObject.cs | 23 ++---------- .../osu.Game.Modes.Taiko.csproj | 1 + 3 files changed, 38 insertions(+), 21 deletions(-) create mode 100644 osu.Game.Modes.Taiko/Objects/Hit.cs diff --git a/osu.Game.Modes.Taiko/Objects/Hit.cs b/osu.Game.Modes.Taiko/Objects/Hit.cs new file mode 100644 index 0000000000..ad8d07d901 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Hit.cs @@ -0,0 +1,35 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Beatmaps.Timing; +using osu.Game.Database; + +namespace osu.Game.Modes.Taiko.Objects +{ + public class Hit : TaikoHitObject + { + /// + /// The hit window that results in a "GREAT" hit. + /// + public double HitWindowGreat = 35; + + /// + /// The hit window that results in a "GOOD" hit. + /// + public double HitWindowGood = 80; + + /// + /// The hit window that results in a "MISS". + /// + public double HitWindowMiss = 95; + + public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) + { + base.ApplyDefaults(timing, difficulty); + + HitWindowGreat = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 50, 35, 20); + HitWindowGood = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 120, 80, 50); + HitWindowMiss = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 135, 95, 70); + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index 61d8ed5f01..4505065489 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -7,28 +7,13 @@ using osu.Game.Modes.Objects; namespace osu.Game.Modes.Taiko.Objects { - public class TaikoHitObject : HitObject + public abstract class TaikoHitObject : HitObject { /// /// HitCircle radius. /// public const float CIRCLE_RADIUS = 64; - /// - /// The hit window that results in a "GREAT" hit. - /// - public double HitWindowGreat = 35; - - /// - /// The hit window that results in a "GOOD" hit. - /// - public double HitWindowGood = 80; - - /// - /// The hit window that results in a "MISS". - /// - public double HitWindowMiss = 95; - /// /// The time to scroll in the HitObject. /// @@ -37,7 +22,7 @@ namespace osu.Game.Modes.Taiko.Objects /// /// Whether this HitObject is in Kiai time. /// - public bool Kiai; + public bool Kiai { get; protected set; } public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) { @@ -50,10 +35,6 @@ namespace osu.Game.Modes.Taiko.Objects if (overridePoint != null) Kiai |= overridePoint.KiaiMode; - - HitWindowGreat = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 50, 35, 20); - HitWindowGood = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 120, 80, 50); - HitWindowMiss = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 135, 95, 70); } } } \ 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 8c3bd1b438..de6444dd5f 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -54,6 +54,7 @@ + From b77b039d73dfd867e7aac68e930fd9e4edca9f7f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 11:25:38 +0900 Subject: [PATCH 26/58] Don't instantiate TaikoHitObject. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 06c0b6c994..0606ee4d5a 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -66,7 +66,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps }; } - return new TaikoHitObject + return new Hit { StartTime = original.StartTime, Sample = original.Sample, From 8b71d70633292c97c6a2d75e3697709a0d23035d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 12:21:09 +0900 Subject: [PATCH 27/58] 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 c173c4b7eeecb67c60026e7470ef2a360e7843da Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 00:22:31 -0300 Subject: [PATCH 28/58] Tab control --- .../Tests/TestCaseBeatmapDetailArea.cs | 27 ++++ .../osu.Desktop.VisualTests.csproj | 1 + .../Graphics/UserInterface/OsuTabControl.cs | 4 +- .../UserInterface/OsuTabControlCheckBox.cs | 134 ++++++++++++++++++ osu.Game/Screens/Select/BeatmapDetailArea.cs | 27 ++++ .../Select/BeatmapDetailAreaTabControl.cs | 75 ++++++++++ osu.Game/osu.Game.csproj | 3 + 7 files changed, 270 insertions(+), 1 deletion(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs create mode 100644 osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs create mode 100644 osu.Game/Screens/Select/BeatmapDetailArea.cs create mode 100644 osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs new file mode 100644 index 0000000000..59859f3f29 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Screens.Testing; +using osu.Game.Screens.Select; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseBeatmapDetailArea : TestCase + { + public override string Description => @"Beatmap details in song select"; + + public override void Reset() + { + base.Reset(); + + Add(new BeatmapDetailArea + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(550f, 450f), + }); + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index b67b4c4bb3..9ca82c9867 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -206,6 +206,7 @@ + diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 8283c1baa0..ad8c17587a 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -28,6 +28,8 @@ namespace osu.Game.Graphics.UserInterface public OsuTabControl() { + TabContainer.Spacing = new Vector2(10f, 0f); + if (!typeof(T).IsEnum) throw new InvalidOperationException("OsuTabControl only supports enums as the generic type argument"); @@ -142,7 +144,7 @@ namespace osu.Game.Graphics.UserInterface { text = new OsuSpriteText { - Margin = new MarginPadding(5), + Margin = new MarginPadding { Top = 5, Bottom = 5 }, Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, TextSize = 14, diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs new file mode 100644 index 0000000000..7d86136fd5 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs @@ -0,0 +1,134 @@ +// 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.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transforms; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Graphics.UserInterface +{ + /// + /// A checkbox styled to be placed in line with an + /// + public class OsuTabControlCheckBox : CheckBox + { + private const float transition_length = 500; + + public event EventHandler Action; + + private Color4 accentColour; + public Color4 AccentColour + { + get { return accentColour; } + set + { + accentColour = value; + + if (State == CheckBoxState.Unchecked) + { + text.Colour = accentColour; + icon.Colour = accentColour; + } + } + } + + public string Text + { + get { return text.Text; } + set { text.Text = value; } + } + + private Box box; + private SpriteText text; + private TextAwesome icon; + + private void fadeIn() + { + box.FadeIn(transition_length, EasingTypes.OutQuint); + text.FadeColour(Color4.White, transition_length, EasingTypes.OutQuint); + } + + private void fadeOut() + { + box.FadeOut(transition_length, EasingTypes.OutQuint); + text.FadeColour(accentColour, transition_length, EasingTypes.OutQuint); + } + + protected override void OnChecked() + { + fadeIn(); + icon.Icon = FontAwesome.fa_check_circle_o; + Action?.Invoke(this, State); + } + + protected override void OnUnchecked() + { + fadeOut(); + icon.Icon = FontAwesome.fa_circle_o; + Action?.Invoke(this, State); + } + + protected override bool OnHover(InputState state) + { + fadeIn(); + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + if (State == CheckBoxState.Unchecked) + fadeOut(); + + base.OnHoverLost(state); + } + + public OsuTabControlCheckBox() + { + AutoSizeAxes = Axes.Both; + + Children = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Margin = new MarginPadding { Top = 5, Bottom = 5, }, + Spacing = new Vector2(5f, 0f), + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + text = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + icon = new TextAwesome + { + TextSize = 14, + Icon = FontAwesome.fa_circle_o, + Shadow = true, + }, + }, + }, + box = new Box + { + RelativeSizeAxes = Axes.X, + Height = 1, + Alpha = 0, + Colour = Color4.White, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + } + }; + } + } +} diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs new file mode 100644 index 0000000000..f576e47780 --- /dev/null +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -0,0 +1,27 @@ +// 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.Primitives; + +namespace osu.Game.Screens.Select +{ + public class BeatmapDetailArea : Container + { + public BeatmapDetailArea() + { + Children = new Drawable[] + { + new BeatmapDetailAreaTabControl + { + RelativeSizeAxes = Axes.X, + }, + new Container + { + Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT }, + }, + }; + } + } +} diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs new file mode 100644 index 0000000000..be3fd43184 --- /dev/null +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -0,0 +1,75 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Screens.Select +{ + public class BeatmapDetailAreaTabControl : Container + { + public static readonly float HEIGHT = 24; + private OsuTabControlCheckBox modsCheckbox; + private OsuTabControl tabs; + + [BackgroundDependencyLoader] + private void load(OsuColour colour) + { + modsCheckbox.AccentColour = tabs.AccentColour = colour.YellowLight; + } + + public BeatmapDetailAreaTabControl() + { + Height = HEIGHT; + + Children = new Drawable[] + { + new Box + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + Height = 1, + Colour = Color4.White.Opacity(0.2f), + }, + tabs = new OsuTabControl + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.Both, + }, + modsCheckbox = new OsuTabControlCheckBox + { + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Text = @"Mods", + }, + }; + + tabs.ItemChanged += (sender, e) => + { + + }; + + modsCheckbox.Action += (sender, e) => + { + + }; + } + } + + public enum BeatmapDetailTab + { + Details, + Local, + Country, + Global, + Friends + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index bfb787cd51..25c96966d9 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -362,6 +362,9 @@ + + + From 87b8015e8f08a4836023382b5b5c024d7f3511d9 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 00:29:28 -0300 Subject: [PATCH 29/58] Cleanup --- .../UserInterface/OsuTabControlCheckBox.cs | 51 +++++++++++-------- osu.Game/Screens/Select/BeatmapDetailArea.cs | 10 ++-- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs index 7d86136fd5..dbdef991f7 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs @@ -22,22 +22,24 @@ namespace osu.Game.Graphics.UserInterface /// public class OsuTabControlCheckBox : CheckBox { - private const float transition_length = 500; + private Box box; + private SpriteText text; + private TextAwesome icon; public event EventHandler Action; - private Color4 accentColour; + private Color4? accentColour; public Color4 AccentColour { - get { return accentColour; } + get { return accentColour.GetValueOrDefault(); } set { accentColour = value; - if (State == CheckBoxState.Unchecked) + if (State != CheckBoxState.Checked) { - text.Colour = accentColour; - icon.Colour = accentColour; + text.Colour = AccentColour; + icon.Colour = AccentColour; } } } @@ -48,22 +50,6 @@ namespace osu.Game.Graphics.UserInterface set { text.Text = value; } } - private Box box; - private SpriteText text; - private TextAwesome icon; - - private void fadeIn() - { - box.FadeIn(transition_length, EasingTypes.OutQuint); - text.FadeColour(Color4.White, transition_length, EasingTypes.OutQuint); - } - - private void fadeOut() - { - box.FadeOut(transition_length, EasingTypes.OutQuint); - text.FadeColour(accentColour, transition_length, EasingTypes.OutQuint); - } - protected override void OnChecked() { fadeIn(); @@ -78,6 +64,20 @@ namespace osu.Game.Graphics.UserInterface Action?.Invoke(this, State); } + private const float transition_length = 500; + + private void fadeIn() + { + box.FadeIn(transition_length, EasingTypes.OutQuint); + text.FadeColour(Color4.White, transition_length, EasingTypes.OutQuint); + } + + private void fadeOut() + { + box.FadeOut(transition_length, EasingTypes.OutQuint); + text.FadeColour(AccentColour, transition_length, EasingTypes.OutQuint); + } + protected override bool OnHover(InputState state) { fadeIn(); @@ -92,6 +92,13 @@ namespace osu.Game.Graphics.UserInterface base.OnHoverLost(state); } + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + if (accentColour == null) + AccentColour = colours.Blue; + } + public OsuTabControlCheckBox() { AutoSizeAxes = Axes.Both; diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index f576e47780..27706a4112 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -9,19 +9,23 @@ namespace osu.Game.Screens.Select { public class BeatmapDetailArea : Container { + private Container content; + protected override Container Content => content; + public BeatmapDetailArea() { - Children = new Drawable[] + AddInternal(new Drawable[] { new BeatmapDetailAreaTabControl { RelativeSizeAxes = Axes.X, }, - new Container + content = new Container { + RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT }, }, - }; + }); } } } From c9fe9e681d561d4a47e118668f29a1e30f8b6b5c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 12:49:28 +0900 Subject: [PATCH 30/58] 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 31/58] 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 32/58] 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 33/58] 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 34/58] 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 35/58] 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 677b8afc1f16c8a44acdda432735c2d507009dd2 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 01:19:29 -0300 Subject: [PATCH 36/58] Integration --- osu.Game/Screens/Select/BeatmapDetailArea.cs | 61 +++++++++++++++++++ .../Select/BeatmapDetailAreaTabControl.cs | 20 +++--- .../Select/Leaderboards/Leaderboard.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 19 ++---- 4 files changed, 77 insertions(+), 25 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 27706a4112..ff66605c76 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -1,17 +1,36 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Transforms; +using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests; +using osu.Game.Screens.Select.Leaderboards; namespace osu.Game.Screens.Select { public class BeatmapDetailArea : Container { + private const float transition_duration = 500; + private Container content; protected override Container Content => content; + public readonly Container Details; //todo: replace with a real details view when added + public readonly Leaderboard Leaderboard; + + private OsuGame game; + + [BackgroundDependencyLoader(permitNulls: true)] + private void load(OsuGame game) + { + this.game = game; + } + public BeatmapDetailArea() { AddInternal(new Drawable[] @@ -19,6 +38,21 @@ namespace osu.Game.Screens.Select new BeatmapDetailAreaTabControl { RelativeSizeAxes = Axes.X, + OnFilter = (tab, mods) => + { + switch (tab) + { + case BeatmapDetailTab.Details: + Details.FadeIn(transition_duration, EasingTypes.OutQuint); + Leaderboard.FadeOut(transition_duration, EasingTypes.OutQuint); + break; + + default: + Details.FadeOut(transition_duration, EasingTypes.OutQuint); + Leaderboard.FadeIn(transition_duration, EasingTypes.OutQuint); + break; + } + }, }, content = new Container { @@ -26,6 +60,33 @@ namespace osu.Game.Screens.Select Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT }, }, }); + + Add(new Drawable[] + { + Details = new Container + { + RelativeSizeAxes = Axes.Both, + }, + Leaderboard = new Leaderboard + { + RelativeSizeAxes = Axes.Both, + } + }); + } + + private GetScoresRequest getScoresRequest; + public void PresentScores(WorkingBeatmap beatmap) + { + if (game == null) return; + + Leaderboard.Scores = null; + getScoresRequest?.Cancel(); + + if (beatmap?.BeatmapInfo == null) return; + + getScoresRequest = new GetScoresRequest(beatmap.BeatmapInfo); + getScoresRequest.Success += r => Leaderboard.Scores = r.Scores; + game.API.Queue(getScoresRequest); } } } diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index be3fd43184..1345fc7a6a 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -1,12 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; 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.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; @@ -18,6 +20,13 @@ namespace osu.Game.Screens.Select private OsuTabControlCheckBox modsCheckbox; private OsuTabControl tabs; + public Action OnFilter; //passed the selected tab and if mods is checked + + private void invokeOnFilter() + { + OnFilter?.Invoke(tabs.SelectedItem, modsCheckbox.State == CheckBoxState.Checked); + } + [BackgroundDependencyLoader] private void load(OsuColour colour) { @@ -52,15 +61,8 @@ namespace osu.Game.Screens.Select }, }; - tabs.ItemChanged += (sender, e) => - { - - }; - - modsCheckbox.Action += (sender, e) => - { - - }; + tabs.ItemChanged += (sender, e) => invokeOnFilter(); + modsCheckbox.Action += (sender, e) => invokeOnFilter(); } } diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 20e6db6241..18691f011f 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -74,7 +74,7 @@ namespace osu.Game.Screens.Select.Leaderboards RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(0f, 5f), - Padding = new MarginPadding(5), + Padding = new MarginPadding { Top = 10, Bottom = 5 }, }, }, }, diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index c5c8543e6b..7d73b17c8e 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -20,7 +20,7 @@ namespace osu.Game.Screens.Select { private OsuScreen player; private ModSelectOverlay modSelect; - private Leaderboard leaderboard; + private BeatmapDetailArea beatmapDetails; public PlaySongSelect() { @@ -32,9 +32,10 @@ namespace osu.Game.Screens.Select Margin = new MarginPadding { Bottom = 50 } }); - LeftContent.Add(leaderboard = new Leaderboard + LeftContent.Add(beatmapDetails = new BeatmapDetailArea { RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Top = 5, Right = 5 }, }); } @@ -58,23 +59,11 @@ namespace osu.Game.Screens.Select { beatmap?.Mods.BindTo(modSelect.SelectedMods); - updateLeaderboard(beatmap); + beatmapDetails.PresentScores(beatmap); base.OnBeatmapChanged(beatmap); } - private void updateLeaderboard(WorkingBeatmap beatmap) - { - leaderboard.Scores = null; - getScoresRequest?.Cancel(); - - if (beatmap?.BeatmapInfo == null) return; - - getScoresRequest = new GetScoresRequest(beatmap.BeatmapInfo); - getScoresRequest.Success += r => leaderboard.Scores = r.Scores; - Game.API.Queue(getScoresRequest); - } - protected override void OnResuming(Screen last) { player = null; From 8e1eef25b4bffd9af63fa14ecb879df2e8180774 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 13:20:17 +0900 Subject: [PATCH 37/58] 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 8c99a8b103ab757f6bb580c2ce9c8156a404673b Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 01:25:30 -0300 Subject: [PATCH 38/58] Remove visual test(pretty useless) --- .../Tests/TestCaseBeatmapDetailArea.cs | 27 ------------------- .../osu.Desktop.VisualTests.csproj | 1 - 2 files changed, 28 deletions(-) delete mode 100644 osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs deleted file mode 100644 index 59859f3f29..0000000000 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK; -using osu.Framework.Graphics; -using osu.Framework.Screens.Testing; -using osu.Game.Screens.Select; - -namespace osu.Desktop.VisualTests.Tests -{ - internal class TestCaseBeatmapDetailArea : TestCase - { - public override string Description => @"Beatmap details in song select"; - - public override void Reset() - { - base.Reset(); - - Add(new BeatmapDetailArea - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(550f, 450f), - }); - } - } -} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 9ca82c9867..b67b4c4bb3 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -206,7 +206,6 @@ - From 67421cdf1c01577bab21da404b9c77e2298f336b Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 01:34:06 -0300 Subject: [PATCH 39/58] Even though it was 5 minutes ago what was I thinking --- .../Tests/TestCaseBeatmapDetailArea.cs | 27 +++++++++++++++++++ .../osu.Desktop.VisualTests.csproj | 1 + .../UserInterface/OsuTabControlCheckBox.cs | 1 - osu.Game/Screens/Select/BeatmapDetailArea.cs | 1 - 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs new file mode 100644 index 0000000000..bb7df19202 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Screens.Testing; +using osu.Game.Screens.Select; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseBeatmapDetailArea : TestCase + { + public override string Description => @"Beatmap details in song select"; + + public override void Reset() + { + base.Reset(); + + Add(new BeatmapDetailArea + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(550f, 450f), + }); + } + } +} \ No newline at end of file diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index b67b4c4bb3..9ca82c9867 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -206,6 +206,7 @@ + diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs index dbdef991f7..1ae3698b9f 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs @@ -5,7 +5,6 @@ using System; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index ff66605c76..5943a0d0ad 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; From b8b45262c5d0f3a1647b83dfe2356b9117910073 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 01:35:55 -0300 Subject: [PATCH 40/58] Formatting --- osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs index 1ae3698b9f..a09173f6e2 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs @@ -17,7 +17,7 @@ using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.UserInterface { /// - /// A checkbox styled to be placed in line with an + /// A checkbox styled to be placed in line with an /// public class OsuTabControlCheckBox : CheckBox { diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 7d73b17c8e..aa3b660479 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -8,11 +8,9 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Online.API.Requests; using osu.Game.Overlays.Mods; using osu.Game.Screens.Edit; using osu.Game.Screens.Play; -using osu.Game.Screens.Select.Leaderboards; namespace osu.Game.Screens.Select { @@ -53,8 +51,6 @@ namespace osu.Game.Screens.Select }, Key.Number3); } - private GetScoresRequest getScoresRequest; - protected override void OnBeatmapChanged(WorkingBeatmap beatmap) { beatmap?.Mods.BindTo(modSelect.SelectedMods); From b8129526a43e0fe326c5d9f10e53e987101a5724 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 02:29:23 -0300 Subject: [PATCH 41/58] Typo --- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 707b1f0f10..9ba289a4f6 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -18,7 +18,7 @@ namespace osu.Game.Screens.Select { private OsuScreen player; private readonly ModSelectOverlay modSelect; - private readonly Leaderboard beatmapDetails; + private readonly BeatmapDetailArea beatmapDetails; public PlaySongSelect() { From 9a3fd8bcf1cc85a53ab5d363e2fedf69f69b46bb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 14:37:00 +0900 Subject: [PATCH 42/58] 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 88d878e1d5c19b8a7b981a5668cd33d54b5f1f3e Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 02:47:27 -0300 Subject: [PATCH 43/58] Formatting --- osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs | 6 +++--- osu.Game/Screens/Select/BeatmapDetailArea.cs | 2 +- osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs index a09173f6e2..7dc1212318 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs @@ -21,9 +21,9 @@ namespace osu.Game.Graphics.UserInterface /// public class OsuTabControlCheckBox : CheckBox { - private Box box; - private SpriteText text; - private TextAwesome icon; + private readonly Box box; + private readonly SpriteText text; + private readonly TextAwesome icon; public event EventHandler Action; diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 5943a0d0ad..30a6420e68 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -16,7 +16,7 @@ namespace osu.Game.Screens.Select { private const float transition_duration = 500; - private Container content; + private readonly Container content; protected override Container Content => content; public readonly Container Details; //todo: replace with a real details view when added diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index 1345fc7a6a..c85f223649 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -17,8 +17,8 @@ namespace osu.Game.Screens.Select public class BeatmapDetailAreaTabControl : Container { public static readonly float HEIGHT = 24; - private OsuTabControlCheckBox modsCheckbox; - private OsuTabControl tabs; + private readonly OsuTabControlCheckBox modsCheckbox; + private readonly OsuTabControl tabs; public Action OnFilter; //passed the selected tab and if mods is checked From acfa4a4aac01802101ce6af487ada902f61e7493 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 14:52:18 +0900 Subject: [PATCH 44/58] 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 45/58] 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 46/58] 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 47/58] 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 48/58] 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 49/58] 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 50/58] 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 . /// From 022fd625df41aa266068cc35fc9268686ecb3eaa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 16:28:40 +0900 Subject: [PATCH 51/58] Remove transitions for now If you want to add transitions, the containers should be IStateful so we can discern their state for later use (because I switched to Show/Hide I can use IsPresent for now). We should probably look at moving the VisibilityState portion of OverlayContainer into a new StatefulContainer class or similar, so it can be used in situations like this. --- osu.Game/Screens/Select/BeatmapDetailArea.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 30a6420e68..ad1ee36ced 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Transforms; using osu.Game.Beatmaps; using osu.Game.Online.API.Requests; using osu.Game.Screens.Select.Leaderboards; @@ -14,8 +13,6 @@ namespace osu.Game.Screens.Select { public class BeatmapDetailArea : Container { - private const float transition_duration = 500; - private readonly Container content; protected override Container Content => content; @@ -42,13 +39,12 @@ namespace osu.Game.Screens.Select switch (tab) { case BeatmapDetailTab.Details: - Details.FadeIn(transition_duration, EasingTypes.OutQuint); - Leaderboard.FadeOut(transition_duration, EasingTypes.OutQuint); + Details.Show(); + Leaderboard.Hide(); break; - default: - Details.FadeOut(transition_duration, EasingTypes.OutQuint); - Leaderboard.FadeIn(transition_duration, EasingTypes.OutQuint); + Details.Hide(); + Leaderboard.Show(); break; } }, From a561611125f2e02fd78e2dce2666150644aae3c2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 16:29:10 +0900 Subject: [PATCH 52/58] Set default tab to global scores. This will need to be saved to the config file eventually. --- osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index c85f223649..9dc8de96d1 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -63,6 +63,8 @@ namespace osu.Game.Screens.Select tabs.ItemChanged += (sender, e) => invokeOnFilter(); modsCheckbox.Action += (sender, e) => invokeOnFilter(); + + tabs.SelectedItem = BeatmapDetailTab.Global; } } From 3ae7d0cb98c5c169f361e823155ec26308e0344f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 16:31:08 +0900 Subject: [PATCH 53/58] Better handle the passing of Beatmap and updating of scores. PresentScores was dangerous as it could potentially bring up unsafe threading scenarios. This ensures everything will work well in all cases. --- osu.Game/Screens/Select/BeatmapDetailArea.cs | 37 ++++++++++++++++---- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index ad1ee36ced..2291e65de8 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -21,10 +21,18 @@ namespace osu.Game.Screens.Select private OsuGame game; - [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuGame game) + private WorkingBeatmap beatmap; + public WorkingBeatmap Beatmap { - this.game = game; + get + { + return beatmap; + } + set + { + beatmap = value; + if (IsLoaded) Schedule(updateScores); + } } public BeatmapDetailArea() @@ -47,6 +55,9 @@ namespace osu.Game.Screens.Select Leaderboard.Show(); break; } + + //for now let's always update scores. + updateScores(); }, }, content = new Container @@ -69,15 +80,27 @@ namespace osu.Game.Screens.Select }); } - private GetScoresRequest getScoresRequest; - public void PresentScores(WorkingBeatmap beatmap) + protected override void LoadComplete() { - if (game == null) return; + base.LoadComplete(); + updateScores(); + } + + [BackgroundDependencyLoader(permitNulls: true)] + private void load(OsuGame game) + { + this.game = game; + } + + private GetScoresRequest getScoresRequest; + private void updateScores() + { + if (game == null || !IsLoaded) return; Leaderboard.Scores = null; getScoresRequest?.Cancel(); - if (beatmap?.BeatmapInfo == null) return; + if (beatmap?.BeatmapInfo == null || !Leaderboard.IsPresent) return; getScoresRequest = new GetScoresRequest(beatmap.BeatmapInfo); getScoresRequest.Success += r => Leaderboard.Scores = r.Scores; diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 9ba289a4f6..9259d33268 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Select { beatmap?.Mods.BindTo(modSelect.SelectedMods); - beatmapDetails.PresentScores(beatmap); + beatmapDetails.Beatmap = beatmap; base.OnBeatmapChanged(beatmap); } From 6bcbd116c8dd2853641cbfb3ea69a0bde73fded4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 16:32:35 +0900 Subject: [PATCH 54/58] Only get APIAccess from DI (it's all we need). --- osu.Game/Screens/Select/BeatmapDetailArea.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 2291e65de8..21e4d643f2 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Game.Beatmaps; +using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Screens.Select.Leaderboards; @@ -19,7 +20,7 @@ namespace osu.Game.Screens.Select public readonly Container Details; //todo: replace with a real details view when added public readonly Leaderboard Leaderboard; - private OsuGame game; + private APIAccess api; private WorkingBeatmap beatmap; public WorkingBeatmap Beatmap @@ -87,24 +88,24 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuGame game) + private void load(APIAccess api) { - this.game = game; + this.api = api; } private GetScoresRequest getScoresRequest; private void updateScores() { - if (game == null || !IsLoaded) return; + if (!IsLoaded) return; Leaderboard.Scores = null; getScoresRequest?.Cancel(); - if (beatmap?.BeatmapInfo == null || !Leaderboard.IsPresent) return; + if (api == null || beatmap?.BeatmapInfo == null || !Leaderboard.IsPresent) return; getScoresRequest = new GetScoresRequest(beatmap.BeatmapInfo); getScoresRequest.Success += r => Leaderboard.Scores = r.Scores; - game.API.Queue(getScoresRequest); + api.Queue(getScoresRequest); } } } From 644e9ae9d5a03be12a0104380a0aa0f20f10d93f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 16:36:52 +0900 Subject: [PATCH 55/58] Increase padding to make flyte happy. --- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 9259d33268..e3a6371c27 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Select LeftContent.Add(beatmapDetails = new BeatmapDetailArea { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = 5, Right = 5 }, + Padding = new MarginPadding { Top = 10, Right = 5 }, }); } From 1766497728d25d6980cb98d4783e14351c00fe8b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 16:53:39 +0900 Subject: [PATCH 56/58] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 06e426da03..34c9f17a6a 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 06e426da039f7bb54aedf5d82c21b8d858a0310e +Subproject commit 34c9f17a6ac6fa5e9fd5569f9e119331316c1313 From 43032ef69452952867d1f11e087ab3ed0faf97d4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 16:56:42 +0900 Subject: [PATCH 57/58] Fix missing class renames. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 9c0673b527..3087b90e36 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -33,7 +33,7 @@ namespace osu.Desktop.VisualTests.Tests { TaikoHitResult hitResult = RNG.Next(2) == 0 ? TaikoHitResult.Good : TaikoHitResult.Great; - playfield.OnJudgement(new DrawableTestHit(new TaikoHitObject()) + playfield.OnJudgement(new DrawableTestHit(new Hit()) { X = RNG.NextSingle(hitResult == TaikoHitResult.Good ? -0.1f : -0.05f, hitResult == TaikoHitResult.Good ? 0.1f : 0.05f), Judgement = new TaikoJudgementInfo @@ -49,7 +49,7 @@ namespace osu.Desktop.VisualTests.Tests private void addMissJudgement() { - playfield.OnJudgement(new DrawableTestHit(new TaikoHitObject()) + playfield.OnJudgement(new DrawableTestHit(new Hit()) { Judgement = new TaikoJudgementInfo { From a61cb078e36e37d97ef65277171bf856b5fdab2f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 17:32:57 +0900 Subject: [PATCH 58/58] Increase timeout on IPC wait. --- osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index ae936f3f49..39fb1bfa8a 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -70,7 +70,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(File.Exists(temp)); var importer = new BeatmapIPCChannel(client); - if (!importer.ImportAsync(temp).Wait(1000)) + if (!importer.ImportAsync(temp).Wait(5000)) Assert.Fail(@"IPC took too long to send"); ensureLoaded(osu);