1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-16 08:42:55 +08:00

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;
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()

View File

@ -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]

View File

@ -22,7 +22,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables
/// </summary>
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;
@ -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[]
{

View File

@ -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
},
};

View File

@ -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;

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
/// such that the playfield is just a bit larger than strong hits.
/// </summary>
public const float PLAYFIELD_HEIGHT = TaikoHitObject.CIRCLE_RADIUS * 2 * 2;
public const float DEFAULT_PLAYFIELD_HEIGHT = TaikoHitObject.CIRCLE_RADIUS * 2 * 2;
/// <summary>
/// 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()
{
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<DrawableBarLine>
@ -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<DrawableTaikoJudgement>
{
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<TaikoHitObject, TaikoJudgement> 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);