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:
parent
a166d03ede
commit
26094ea325
@ -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[]
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user