2019-01-24 08:43:03 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-09-21 06:08:43 +00:00
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2019-11-20 12:19:49 +00:00
|
|
|
using System;
|
2022-03-13 05:21:52 +00:00
|
|
|
using osu.Framework.Bindables;
|
2019-03-26 04:31:49 +00:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Game.Rulesets.UI;
|
2018-09-21 06:08:43 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.UI
|
|
|
|
{
|
2019-03-26 04:31:49 +00:00
|
|
|
public class TaikoPlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer
|
2018-09-21 06:08:43 +00:00
|
|
|
{
|
|
|
|
private const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768;
|
|
|
|
private const float default_aspect = 16f / 9f;
|
|
|
|
|
2022-03-13 05:21:52 +00:00
|
|
|
public readonly IBindable<bool> LockPlayfieldAspect = new BindableBool(true);
|
|
|
|
|
2018-09-21 06:08:43 +00:00
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
|
2022-03-13 05:21:52 +00:00
|
|
|
float height = default_relative_height;
|
|
|
|
|
|
|
|
if (LockPlayfieldAspect.Value)
|
|
|
|
height *= Math.Clamp(Parent.ChildSize.X / Parent.ChildSize.Y, 0.4f, 4) / default_aspect;
|
|
|
|
|
|
|
|
Height = height;
|
2020-05-12 06:51:59 +00:00
|
|
|
|
|
|
|
// Position the taiko playfield exactly one playfield from the top of the screen.
|
|
|
|
RelativePositionAxes = Axes.Y;
|
2022-03-13 05:21:52 +00:00
|
|
|
Y = height;
|
2018-09-21 06:08:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|