Make taiko playfield scale by height.

This commit is contained in:
smoogipooo 2017-04-10 05:08:05 +09:00
parent adc16b0727
commit c882b9bafd
6 changed files with 32 additions and 15 deletions

View File

@ -61,17 +61,24 @@ namespace osu.Desktop.VisualTests.Tests
{ {
TaikoHitResult hitResult = RNG.Next(2) == 0 ? TaikoHitResult.Good : TaikoHitResult.Great; 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), X = RNG.NextSingle(hitResult == TaikoHitResult.Good ? -0.1f : -0.05f, hitResult == TaikoHitResult.Good ? 0.1f : 0.05f),
Judgement = new TaikoJudgement Judgement = new TaikoJudgement
{ {
Result = HitResult.Hit, Result = HitResult.Hit,
TaikoResult = hitResult, TaikoResult = hitResult,
TimeOffset = 0, TimeOffset = 0
SecondHit = RNG.Next(10) == 0
} }
}); };
playfield.OnJudgement(h);
if (RNG.Next(10) == 0)
{
h.Judgement.SecondHit = true;
playfield.OnJudgement(h);
}
} }
private void addMissJudgement() private void addMissJudgement()

View File

@ -49,7 +49,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables
protected override TaikoPiece CreateMainPiece() => new ElongatedCirclePiece(HitObject.IsStrong) protected override TaikoPiece CreateMainPiece() => new ElongatedCirclePiece(HitObject.IsStrong)
{ {
Length = (float)(HitObject.Duration / HitObject.ScrollTime), Length = (float)(HitObject.Duration / HitObject.ScrollTime),
PlayfieldLengthReference = () => Parent.DrawSize.X PlayfieldLengthReference = () => Parent.DrawSize.X / DrawScale.X
}; };
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -22,7 +22,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables
/// </summary> /// </summary>
private readonly List<Key> validKeys = new List<Key>(new[] { Key.D, Key.F, Key.J, Key.K }); private readonly List<Key> validKeys = new List<Key>(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<Drawable> Content => bodyContainer; protected override Container<Drawable> Content => bodyContainer;
@ -46,6 +46,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables
AddInternal(bodyContainer = new Container AddInternal(bodyContainer = new Container
{ {
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new[] Children = new[]
{ {

View File

@ -37,7 +37,7 @@ namespace osu.Game.Modes.Taiko.UI
public HitTarget() public HitTarget()
{ {
RelativeSizeAxes = Axes.Y; Size = new Vector2(TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT);
Children = new Drawable[] Children = new Drawable[]
{ {
@ -47,7 +47,7 @@ namespace osu.Game.Modes.Taiko.UI
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Y = border_offset, 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 Alpha = 0.1f
}, },
new CircularContainer new CircularContainer
@ -96,7 +96,7 @@ namespace osu.Game.Modes.Taiko.UI
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
Y = -border_offset, 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 Alpha = 0.1f
}, },
}; };

View File

@ -21,7 +21,7 @@ namespace osu.Game.Modes.Taiko.UI
{ {
public InputDrum() public InputDrum()
{ {
Size = new Vector2(TaikoPlayfield.PLAYFIELD_HEIGHT); Size = new Vector2(TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT);
const float middle_split = 10; const float middle_split = 10;

View File

@ -25,7 +25,7 @@ namespace osu.Game.Modes.Taiko.UI
/// The play field height. This is relative to the size of hit objects /// 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. /// such that the playfield is just a bit larger than strong hits.
/// </summary> /// </summary>
public const float PLAYFIELD_HEIGHT = TaikoHitObject.CIRCLE_RADIUS * 2 * 2; public const float DEFAULT_PLAYFIELD_HEIGHT = TaikoHitObject.CIRCLE_RADIUS * 2 * 2;
/// <summary> /// <summary>
/// The offset from <see cref="left_area_size"/> which the center of the hit target lies at. /// The offset from <see cref="left_area_size"/> which the center of the hit target lies at.
@ -53,7 +53,7 @@ namespace osu.Game.Modes.Taiko.UI
public TaikoPlayfield() public TaikoPlayfield()
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = PLAYFIELD_HEIGHT; Height = DEFAULT_PLAYFIELD_HEIGHT;
AddInternal(new Drawable[] AddInternal(new Drawable[]
{ {
@ -93,7 +93,8 @@ namespace osu.Game.Modes.Taiko.UI
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), Size = new Vector2(DEFAULT_PLAYFIELD_HEIGHT),
FillMode = FillMode.Fit,
BlendingMode = BlendingMode.Additive BlendingMode = BlendingMode.Additive
}, },
barLineContainer = new Container<DrawableBarLine> barLineContainer = new Container<DrawableBarLine>
@ -104,6 +105,7 @@ namespace osu.Game.Modes.Taiko.UI
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.Centre, Origin = Anchor.Centre,
FillMode = FillMode.Fit
}, },
hitObjectContainer = new Container hitObjectContainer = new Container
{ {
@ -111,7 +113,8 @@ namespace osu.Game.Modes.Taiko.UI
}, },
judgementContainer = new Container<DrawableTaikoJudgement> judgementContainer = new Container<DrawableTaikoJudgement>
{ {
RelativeSizeAxes = Axes.Both, Size = new Vector2(DEFAULT_PLAYFIELD_HEIGHT),
FillMode = FillMode.Fit,
BlendingMode = BlendingMode.Additive BlendingMode = BlendingMode.Additive
}, },
}, },
@ -120,7 +123,8 @@ namespace osu.Game.Modes.Taiko.UI
}, },
leftBackgroundContainer = new Container leftBackgroundContainer = new Container
{ {
Size = new Vector2(left_area_size, PLAYFIELD_HEIGHT), RelativeSizeAxes = Axes.Y,
Width = left_area_size,
BorderThickness = 1, BorderThickness = 1,
Children = new Drawable[] Children = new Drawable[]
{ {
@ -134,6 +138,7 @@ namespace osu.Game.Modes.Taiko.UI
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativePositionAxes = Axes.X, RelativePositionAxes = Axes.X,
Position = new Vector2(0.10f, 0), Position = new Vector2(0.10f, 0),
FillMode = FillMode.Fit,
Scale = new Vector2(0.9f) Scale = new Vector2(0.9f)
}, },
new Box new Box
@ -164,6 +169,9 @@ namespace osu.Game.Modes.Taiko.UI
public override void Add(DrawableHitObject<TaikoHitObject, TaikoJudgement> h) public override void Add(DrawableHitObject<TaikoHitObject, TaikoJudgement> h)
{ {
h.AutoSizeAxes = h.AutoSizeAxes & ~Axes.Y;
h.Height = DEFAULT_PLAYFIELD_HEIGHT;
h.FillMode = FillMode.Fit;
h.Depth = (float)h.HitObject.StartTime; h.Depth = (float)h.HitObject.StartTime;
base.Add(h); base.Add(h);