1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Merge branch 'master' into ladder-grid-expand

This commit is contained in:
Bartłomiej Dach 2023-07-28 22:51:33 +02:00
commit 0c10d875ce
No known key found for this signature in database
3 changed files with 26 additions and 6 deletions

View File

@ -11,6 +11,8 @@ namespace osu.Game.Rulesets.Taiko.Edit
{
public partial class TaikoHitObjectComposer : HitObjectComposer<TaikoHitObject>
{
protected override bool ApplyHorizontalCentering => false;
public TaikoHitObjectComposer(TaikoRuleset ruleset)
: base(ruleset)
{

View File

@ -136,11 +136,11 @@ namespace osu.Game.Tournament.Components
if (match.NewValue != null)
match.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged;
updateState();
Scheduler.AddOnce(updateState);
}
private void picksBansOnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
=> updateState();
=> Scheduler.AddOnce(updateState);
private BeatmapChoice? choice;

View File

@ -44,6 +44,11 @@ namespace osu.Game.Rulesets.Edit
public abstract partial class HitObjectComposer<TObject> : HitObjectComposer, IPlacementHandler
where TObject : HitObject
{
/// <summary>
/// Whether the playfield should be centered horizontally. Should be disabled for playfields which span the full horizontal width.
/// </summary>
protected virtual bool ApplyHorizontalCentering => true;
protected IRulesetConfigManager Config { get; private set; }
// Provides `Playfield`
@ -119,8 +124,6 @@ namespace osu.Game.Rulesets.Edit
{
Name = "Playfield content",
RelativeSizeAxes = Axes.Y,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
// layers below playfield
@ -241,8 +244,23 @@ namespace osu.Game.Rulesets.Edit
{
base.Update();
// Ensure that the playfield is always centered but also doesn't get cut off by toolboxes.
PlayfieldContentContainer.Width = Math.Max(1024, DrawWidth) - TOOLBOX_CONTRACTED_SIZE_RIGHT * 2;
if (ApplyHorizontalCentering)
{
PlayfieldContentContainer.Anchor = Anchor.Centre;
PlayfieldContentContainer.Origin = Anchor.Centre;
// Ensure that the playfield is always centered but also doesn't get cut off by toolboxes.
PlayfieldContentContainer.Width = Math.Max(1024, DrawWidth) - TOOLBOX_CONTRACTED_SIZE_RIGHT * 2;
PlayfieldContentContainer.X = 0;
}
else
{
PlayfieldContentContainer.Anchor = Anchor.CentreLeft;
PlayfieldContentContainer.Origin = Anchor.CentreLeft;
PlayfieldContentContainer.Width = Math.Max(1024, DrawWidth) - (TOOLBOX_CONTRACTED_SIZE_LEFT + TOOLBOX_CONTRACTED_SIZE_RIGHT);
PlayfieldContentContainer.X = TOOLBOX_CONTRACTED_SIZE_LEFT;
}
}
public override Playfield Playfield => drawableRulesetWrapper.Playfield;