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

Fix playfield border size not updating in editor on circle size change

This commit is contained in:
Bartłomiej Dach 2024-06-17 09:36:01 +02:00
parent 97003b3679
commit 1b00d0181a
No known key found for this signature in database
2 changed files with 29 additions and 1 deletions

View File

@ -2,10 +2,13 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Edit;
using osuTK;
namespace osu.Game.Rulesets.Osu.Edit
@ -23,12 +26,32 @@ namespace osu.Game.Rulesets.Osu.Edit
private partial class OsuEditorPlayfield : OsuPlayfield
{
[Resolved]
private EditorBeatmap editorBeatmap { get; set; } = null!;
protected override GameplayCursorContainer? CreateCursor() => null;
public OsuEditorPlayfield()
{
HitPolicy = new AnyOrderHitPolicy();
}
protected override void LoadComplete()
{
base.LoadComplete();
editorBeatmap.BeatmapReprocessed += onBeatmapReprocessed;
}
private void onBeatmapReprocessed() => ApplyCircleSizeToPlayfieldBorder(editorBeatmap);
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (editorBeatmap.IsNotNull())
editorBeatmap.BeatmapReprocessed -= onBeatmapReprocessed;
}
}
}
}

View File

@ -159,7 +159,12 @@ namespace osu.Game.Rulesets.Osu.UI
RegisterPool<SpinnerBonusTick, DrawableSpinnerBonusTick>(10, 200);
if (beatmap != null)
borderContainer.Padding = new MarginPadding(OsuHitObject.OBJECT_RADIUS * -LegacyRulesetExtensions.CalculateScaleFromCircleSize(beatmap.Difficulty.CircleSize, true));
ApplyCircleSizeToPlayfieldBorder(beatmap);
}
protected void ApplyCircleSizeToPlayfieldBorder(IBeatmap beatmap)
{
borderContainer.Padding = new MarginPadding(OsuHitObject.OBJECT_RADIUS * -LegacyRulesetExtensions.CalculateScaleFromCircleSize(beatmap.Difficulty.CircleSize, true));
}
protected override HitObjectLifetimeEntry CreateLifetimeEntry(HitObject hitObject) => new OsuHitObjectLifetimeEntry(hitObject);