From c882b9bafd96f752433d0e596350cd58e6632559 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 10 Apr 2017 05:08:05 +0900 Subject: [PATCH] Make taiko playfield scale by height. --- .../Tests/TestCaseTaikoPlayfield.cs | 15 +++++++++++---- .../Objects/Drawables/DrawableDrumRoll.cs | 2 +- .../Drawables/DrawableTaikoHitObject.cs | 4 +++- osu.Game.Modes.Taiko/UI/HitTarget.cs | 6 +++--- osu.Game.Modes.Taiko/UI/InputDrum.cs | 2 +- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 18 +++++++++++++----- 6 files changed, 32 insertions(+), 15 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 88a037afee..a942535d06 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -61,17 +61,24 @@ namespace osu.Desktop.VisualTests.Tests { TaikoHitResult hitResult = RNG.Next(2) == 0 ? TaikoHitResult.Good : TaikoHitResult.Great; - playfield.OnJudgement(new DrawableTestHit(new Hit()) + var h = new DrawableTestHit(new Hit()) { X = RNG.NextSingle(hitResult == TaikoHitResult.Good ? -0.1f : -0.05f, hitResult == TaikoHitResult.Good ? 0.1f : 0.05f), Judgement = new TaikoJudgement { Result = HitResult.Hit, TaikoResult = hitResult, - TimeOffset = 0, - SecondHit = RNG.Next(10) == 0 + TimeOffset = 0 } - }); + }; + + playfield.OnJudgement(h); + + if (RNG.Next(10) == 0) + { + h.Judgement.SecondHit = true; + playfield.OnJudgement(h); + } } private void addMissJudgement() diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs index 0a0098dd34..695717ce9e 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -49,7 +49,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables protected override TaikoPiece CreateMainPiece() => new ElongatedCirclePiece(HitObject.IsStrong) { Length = (float)(HitObject.Duration / HitObject.ScrollTime), - PlayfieldLengthReference = () => Parent.DrawSize.X + PlayfieldLengthReference = () => Parent.DrawSize.X / DrawScale.X }; [BackgroundDependencyLoader] diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index f15f2bd152..7cd9f9baa5 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -22,7 +22,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables /// private readonly List validKeys = new List(new[] { Key.D, Key.F, Key.J, Key.K }); - public override Vector2 OriginPosition => new Vector2(DrawHeight / 2); + public override Vector2 OriginPosition => new Vector2(bodyContainer.DrawHeight / 2f, DrawHeight / 2f); protected override Container Content => bodyContainer; @@ -46,6 +46,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables AddInternal(bodyContainer = new Container { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Children = new[] { diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs index a17480628d..f5d6a3b797 100644 --- a/osu.Game.Modes.Taiko/UI/HitTarget.cs +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -37,7 +37,7 @@ namespace osu.Game.Modes.Taiko.UI public HitTarget() { - RelativeSizeAxes = Axes.Y; + Size = new Vector2(TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT); Children = new Drawable[] { @@ -47,7 +47,7 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Y = border_offset, - Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - strong_hit_diameter) / 2f - border_offset), + Size = new Vector2(border_thickness, (TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT - strong_hit_diameter) / 2f - border_offset), Alpha = 0.1f }, new CircularContainer @@ -96,7 +96,7 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Y = -border_offset, - Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - strong_hit_diameter) / 2f - border_offset), + Size = new Vector2(border_thickness, (TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT - strong_hit_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 0c1e1105cb..d238c38e74 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -21,7 +21,7 @@ namespace osu.Game.Modes.Taiko.UI { public InputDrum() { - Size = new Vector2(TaikoPlayfield.PLAYFIELD_HEIGHT); + Size = new Vector2(TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT); const float middle_split = 10; diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 9e7eb571a1..0407cbc5fd 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -25,7 +25,7 @@ namespace osu.Game.Modes.Taiko.UI /// The play field height. This is relative to the size of hit objects /// such that the playfield is just a bit larger than strong hits. /// - public const float PLAYFIELD_HEIGHT = TaikoHitObject.CIRCLE_RADIUS * 2 * 2; + public const float DEFAULT_PLAYFIELD_HEIGHT = TaikoHitObject.CIRCLE_RADIUS * 2 * 2; /// /// The offset from which the center of the hit target lies at. @@ -53,7 +53,7 @@ namespace osu.Game.Modes.Taiko.UI public TaikoPlayfield() { RelativeSizeAxes = Axes.X; - Height = PLAYFIELD_HEIGHT; + Height = DEFAULT_PLAYFIELD_HEIGHT; AddInternal(new Drawable[] { @@ -93,7 +93,8 @@ namespace osu.Game.Modes.Taiko.UI { Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, - Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), + Size = new Vector2(DEFAULT_PLAYFIELD_HEIGHT), + FillMode = FillMode.Fit, BlendingMode = BlendingMode.Additive }, barLineContainer = new Container @@ -104,6 +105,7 @@ namespace osu.Game.Modes.Taiko.UI { Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, + FillMode = FillMode.Fit }, hitObjectContainer = new Container { @@ -111,7 +113,8 @@ namespace osu.Game.Modes.Taiko.UI }, judgementContainer = new Container { - RelativeSizeAxes = Axes.Both, + Size = new Vector2(DEFAULT_PLAYFIELD_HEIGHT), + FillMode = FillMode.Fit, BlendingMode = BlendingMode.Additive }, }, @@ -120,7 +123,8 @@ namespace osu.Game.Modes.Taiko.UI }, leftBackgroundContainer = new Container { - Size = new Vector2(left_area_size, PLAYFIELD_HEIGHT), + RelativeSizeAxes = Axes.Y, + Width = left_area_size, BorderThickness = 1, Children = new Drawable[] { @@ -134,6 +138,7 @@ namespace osu.Game.Modes.Taiko.UI Origin = Anchor.Centre, RelativePositionAxes = Axes.X, Position = new Vector2(0.10f, 0), + FillMode = FillMode.Fit, Scale = new Vector2(0.9f) }, new Box @@ -164,6 +169,9 @@ namespace osu.Game.Modes.Taiko.UI public override void Add(DrawableHitObject h) { + h.AutoSizeAxes = h.AutoSizeAxes & ~Axes.Y; + h.Height = DEFAULT_PLAYFIELD_HEIGHT; + h.FillMode = FillMode.Fit; h.Depth = (float)h.HitObject.StartTime; base.Add(h);