mirror of
https://github.com/ppy/osu
synced 2025-03-20 01:49:41 +00:00
Merge branch 'master' into playfield-skin-layer
This commit is contained in:
commit
4db203ecc3
@ -11,6 +11,8 @@ namespace osu.Game.Rulesets.Taiko.Edit
|
|||||||
{
|
{
|
||||||
public partial class TaikoHitObjectComposer : HitObjectComposer<TaikoHitObject>
|
public partial class TaikoHitObjectComposer : HitObjectComposer<TaikoHitObject>
|
||||||
{
|
{
|
||||||
|
protected override bool ApplyHorizontalCentering => false;
|
||||||
|
|
||||||
public TaikoHitObjectComposer(TaikoRuleset ruleset)
|
public TaikoHitObjectComposer(TaikoRuleset ruleset)
|
||||||
: base(ruleset)
|
: base(ruleset)
|
||||||
{
|
{
|
||||||
|
@ -136,11 +136,11 @@ namespace osu.Game.Tournament.Components
|
|||||||
if (match.NewValue != null)
|
if (match.NewValue != null)
|
||||||
match.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged;
|
match.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged;
|
||||||
|
|
||||||
updateState();
|
Scheduler.AddOnce(updateState);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void picksBansOnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
private void picksBansOnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
||||||
=> updateState();
|
=> Scheduler.AddOnce(updateState);
|
||||||
|
|
||||||
private BeatmapChoice? choice;
|
private BeatmapChoice? choice;
|
||||||
|
|
||||||
|
@ -37,6 +37,8 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
|
|
||||||
private WarningBox rightClickMessage;
|
private WarningBox rightClickMessage;
|
||||||
|
|
||||||
|
private RectangularPositionSnapGrid grid;
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private IDialogOverlay dialogOverlay { get; set; }
|
private IDialogOverlay dialogOverlay { get; set; }
|
||||||
@ -53,10 +55,12 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
|
|
||||||
AddInternal(rightClickMessage = new WarningBox("Right click to place and link matches"));
|
AddInternal(rightClickMessage = new WarningBox("Right click to place and link matches"));
|
||||||
|
|
||||||
ScrollContent.Add(new RectangularPositionSnapGrid(Vector2.Zero)
|
ScrollContent.Add(grid = new RectangularPositionSnapGrid(Vector2.Zero)
|
||||||
{
|
{
|
||||||
Spacing = new Vector2(GRID_SPACING),
|
Spacing = new Vector2(GRID_SPACING),
|
||||||
RelativeSizeAxes = Axes.Both,
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
BypassAutoSizeAxes = Axes.Both,
|
||||||
Depth = float.MaxValue
|
Depth = float.MaxValue
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -64,6 +68,22 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
updateMessage();
|
updateMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
// Expand grid with the content to allow going beyond the bounds of the screen.
|
||||||
|
grid.Size = ScrollContent.Size + new Vector2(GRID_SPACING * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vector2 lastMatchesContainerMouseDownPosition;
|
||||||
|
|
||||||
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
|
{
|
||||||
|
lastMatchesContainerMouseDownPosition = MatchesContainer.ToLocalSpace(e.ScreenSpaceMouseDownPosition);
|
||||||
|
return base.OnMouseDown(e);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateMessage()
|
private void updateMessage()
|
||||||
{
|
{
|
||||||
rightClickMessage.Alpha = LadderInfo.Matches.Count > 0 ? 0 : 1;
|
rightClickMessage.Alpha = LadderInfo.Matches.Count > 0 ? 0 : 1;
|
||||||
@ -85,7 +105,8 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
{
|
{
|
||||||
new OsuMenuItem("Create new match", MenuItemType.Highlighted, () =>
|
new OsuMenuItem("Create new match", MenuItemType.Highlighted, () =>
|
||||||
{
|
{
|
||||||
Vector2 pos = MatchesContainer.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position);
|
Vector2 pos = MatchesContainer.Count == 0 ? Vector2.Zero : lastMatchesContainerMouseDownPosition;
|
||||||
|
|
||||||
TournamentMatch newMatch = new TournamentMatch { Position = { Value = new Point((int)pos.X, (int)pos.Y) } };
|
TournamentMatch newMatch = new TournamentMatch { Position = { Value = new Point((int)pos.X, (int)pos.Y) } };
|
||||||
|
|
||||||
LadderInfo.Matches.Add(newMatch);
|
LadderInfo.Matches.Add(newMatch);
|
||||||
|
@ -57,12 +57,15 @@ namespace osu.Game.Tournament.Screens.Ladder
|
|||||||
},
|
},
|
||||||
ScrollContent = new LadderDragContainer
|
ScrollContent = new LadderDragContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
paths = new Container<Path> { RelativeSizeAxes = Axes.Both },
|
paths = new Container<Path> { RelativeSizeAxes = Axes.Both },
|
||||||
headings = new Container { RelativeSizeAxes = Axes.Both },
|
headings = new Container { RelativeSizeAxes = Axes.Both },
|
||||||
MatchesContainer = new Container<DrawableTournamentMatch> { RelativeSizeAxes = Axes.Both },
|
MatchesContainer = new Container<DrawableTournamentMatch>
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,11 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
public abstract partial class HitObjectComposer<TObject> : HitObjectComposer, IPlacementHandler
|
public abstract partial class HitObjectComposer<TObject> : HitObjectComposer, IPlacementHandler
|
||||||
where TObject : HitObject
|
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; }
|
protected IRulesetConfigManager Config { get; private set; }
|
||||||
|
|
||||||
// Provides `Playfield`
|
// Provides `Playfield`
|
||||||
@ -119,8 +124,6 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
{
|
{
|
||||||
Name = "Playfield content",
|
Name = "Playfield content",
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
// layers below playfield
|
// layers below playfield
|
||||||
@ -241,8 +244,23 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
|
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.
|
// 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.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;
|
public override Playfield Playfield => drawableRulesetWrapper.Playfield;
|
||||||
|
@ -54,7 +54,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
if (!gridCache.IsValid)
|
if (!gridCache.IsValid)
|
||||||
{
|
{
|
||||||
ClearInternal();
|
ClearInternal();
|
||||||
|
|
||||||
|
if (DrawWidth > 0 && DrawHeight > 0)
|
||||||
createContent();
|
createContent();
|
||||||
|
|
||||||
gridCache.Validate();
|
gridCache.Validate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user