mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 21:03:21 +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,
|
RelativeSizeAxes = Axes.Both,
|
||||||
FillMode = FillMode.Fit,
|
FillMode = FillMode.Fit,
|
||||||
FillAspectRatio = 4f / 3,
|
FillAspectRatio = 4f / 3,
|
||||||
Child = new ScalingContainer(BASE_WIDTH)
|
Child = new PlayfieldLayer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
|
@ -6,23 +6,13 @@ using OpenTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.UI
|
namespace osu.Game.Rulesets.Catch.UI
|
||||||
{
|
{
|
||||||
/// <summary>
|
public class PlayfieldLayer : Container
|
||||||
/// A <see cref="Container"/> which scales its content relative to a target width.
|
|
||||||
/// </summary>
|
|
||||||
public class ScalingContainer : Container
|
|
||||||
{
|
{
|
||||||
private readonly float targetWidth;
|
|
||||||
|
|
||||||
public ScalingContainer(float targetWidth)
|
|
||||||
{
|
|
||||||
this.targetWidth = targetWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.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);
|
Size = Vector2.Divide(Vector2.One, Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
FillMode = FillMode.Fit,
|
FillMode = FillMode.Fit,
|
||||||
FillAspectRatio = 4f / 3,
|
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>
|
/// </summary>
|
||||||
private class ScalingContainer : Container
|
private class ScalingContainer : Container
|
||||||
{
|
{
|
||||||
private readonly float targetWidth;
|
|
||||||
|
|
||||||
public ScalingContainer(float targetWidth)
|
|
||||||
{
|
|
||||||
this.targetWidth = targetWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.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);
|
Size = Vector2.Divide(Vector2.One, Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user