1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 21:52:55 +08:00

Simplify + rename playfield layers in Osu/Catch

This commit is contained in:
smoogipoo 2018-09-21 15:01:58 +09:00
parent a166d03ede
commit 26094ea325
3 changed files with 5 additions and 22 deletions

View File

@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Catch.UI
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
FillAspectRatio = 4f / 3,
Child = new ScalingContainer(BASE_WIDTH)
Child = new PlayfieldLayer
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]

View File

@ -6,23 +6,13 @@ using OpenTK;
namespace osu.Game.Rulesets.Catch.UI
{
/// <summary>
/// A <see cref="Container"/> which scales its content relative to a target width.
/// </summary>
public class ScalingContainer : Container
public class PlayfieldLayer : Container
{
private readonly float targetWidth;
public ScalingContainer(float targetWidth)
{
this.targetWidth = targetWidth;
}
protected override void Update()
{
base.Update();
Scale = new Vector2(Parent.ChildSize.X / targetWidth);
Scale = new Vector2(Parent.ChildSize.X / CatchPlayfield.BASE_WIDTH);
Size = Vector2.Divide(Vector2.One, Scale);
}
}

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.UI
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
FillAspectRatio = 4f / 3,
Child = content = new ScalingContainer(OsuPlayfield.BASE_SIZE.X) { RelativeSizeAxes = Axes.Both }
Child = content = new ScalingContainer { RelativeSizeAxes = Axes.Both }
};
}
@ -30,18 +30,11 @@ namespace osu.Game.Rulesets.Osu.UI
/// </summary>
private class ScalingContainer : Container
{
private readonly float targetWidth;
public ScalingContainer(float targetWidth)
{
this.targetWidth = targetWidth;
}
protected override void Update()
{
base.Update();
Scale = new Vector2(Parent.ChildSize.X / targetWidth);
Scale = new Vector2(Parent.ChildSize.X / OsuPlayfield.BASE_SIZE.X);
Size = Vector2.Divide(Vector2.One, Scale);
}
}