2021-06-22 11:47:24 +08: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.
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
2024-10-16 03:13:04 +08:00
|
|
|
using osu.Framework.Allocation;
|
2022-10-06 17:06:16 +08:00
|
|
|
using osu.Framework.Bindables;
|
2024-10-16 03:13:04 +08:00
|
|
|
using osu.Framework.Extensions.ObjectExtensions;
|
2021-06-22 11:47:24 +08:00
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Rulesets.Catch.UI;
|
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
using osu.Game.Rulesets.UI;
|
2024-10-16 03:13:04 +08:00
|
|
|
using osu.Game.Screens.Edit;
|
2021-06-22 11:47:24 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Edit
|
|
|
|
{
|
|
|
|
public partial class DrawableCatchEditorRuleset : DrawableCatchRuleset
|
|
|
|
{
|
2024-10-16 03:13:04 +08:00
|
|
|
[Resolved]
|
|
|
|
private EditorBeatmap editorBeatmap { get; set; } = null!;
|
|
|
|
|
2022-10-06 17:06:16 +08:00
|
|
|
public readonly BindableDouble TimeRangeMultiplier = new BindableDouble(1);
|
|
|
|
|
2023-01-15 15:00:34 +08:00
|
|
|
public DrawableCatchEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod>? mods = null)
|
2021-06-22 11:47:24 +08:00
|
|
|
: base(ruleset, beatmap, mods)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-10-06 16:26:03 +08:00
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
|
|
|
|
double gamePlayTimeRange = GetTimeRange(Beatmap.Difficulty.ApproachRate);
|
2022-10-06 17:06:16 +08:00
|
|
|
float playfieldStretch = Playfield.DrawHeight / CatchPlayfield.HEIGHT;
|
|
|
|
TimeRange.Value = gamePlayTimeRange * TimeRangeMultiplier.Value * playfieldStretch;
|
2022-10-06 16:26:03 +08:00
|
|
|
}
|
|
|
|
|
2024-10-16 03:13:04 +08:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
editorBeatmap.BeatmapReprocessed += onBeatmapReprocessed;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Dispose(bool isDisposing)
|
|
|
|
{
|
|
|
|
base.Dispose(isDisposing);
|
|
|
|
|
|
|
|
if (editorBeatmap.IsNotNull())
|
|
|
|
editorBeatmap.BeatmapReprocessed -= onBeatmapReprocessed;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void onBeatmapReprocessed() => (Playfield as CatchEditorPlayfield)?.ApplyCircleSizeToCatcher(editorBeatmap.Difficulty);
|
|
|
|
|
2021-10-02 11:34:29 +08:00
|
|
|
protected override Playfield CreatePlayfield() => new CatchEditorPlayfield(Beatmap.Difficulty);
|
2022-10-06 16:26:03 +08:00
|
|
|
|
|
|
|
public override PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => new CatchEditorPlayfieldAdjustmentContainer();
|
2021-06-22 11:47:24 +08:00
|
|
|
}
|
|
|
|
}
|