mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 08:27:49 +08:00
Merge branch 'master' into timeline-drag-selection-crash
This commit is contained in:
commit
14104e57d4
@ -10,7 +10,7 @@
|
|||||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.528.1" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.618.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- Fody does not handle Android build well, and warns when unchanged.
|
<!-- Fody does not handle Android build well, and warns when unchanged.
|
||||||
|
@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Catch.Tests.Mods
|
|||||||
StartTime = 5000,
|
StartTime = 5000,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(2000, 4000),
|
new BreakPeriod(2000, 4000),
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
|||||||
value *= Math.Pow(accuracy(), 5.5);
|
value *= Math.Pow(accuracy(), 5.5);
|
||||||
|
|
||||||
if (score.Mods.Any(m => m is ModNoFail))
|
if (score.Mods.Any(m => m is ModNoFail))
|
||||||
value *= 0.90;
|
value *= Math.Max(0.90, 1.0 - 0.02 * numMiss);
|
||||||
|
|
||||||
return new CatchPerformanceAttributes
|
return new CatchPerformanceAttributes
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
inputManager = GetContainingInputManager();
|
inputManager = GetContainingInputManager()!;
|
||||||
|
|
||||||
BeginPlacement();
|
BeginPlacement();
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,8 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
{
|
{
|
||||||
base.CreateNestedHitObjects(cancellationToken);
|
base.CreateNestedHitObjects(cancellationToken);
|
||||||
|
|
||||||
|
this.PopulateNodeSamples();
|
||||||
|
|
||||||
var dropletSamples = Samples.Select(s => s.With(@"slidertick")).ToList();
|
var dropletSamples = Samples.Select(s => s.With(@"slidertick")).ToList();
|
||||||
|
|
||||||
int nodeIndex = 0;
|
int nodeIndex = 0;
|
||||||
|
@ -84,7 +84,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
var replayState = (GetContainingInputManager().CurrentState as RulesetInputManagerInputState<CatchAction>)?.LastReplayState as CatchFramedReplayInputHandler.CatchReplayState;
|
var replayState = (GetContainingInputManager()!.CurrentState as RulesetInputManagerInputState<CatchAction>)?.LastReplayState as CatchFramedReplayInputHandler.CatchReplayState;
|
||||||
|
|
||||||
SetCatcherPosition(
|
SetCatcherPosition(
|
||||||
replayState?.CatcherX ??
|
replayState?.CatcherX ??
|
||||||
|
@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
AddStep("Hold key", () =>
|
AddStep("Hold key", () =>
|
||||||
{
|
{
|
||||||
clock.CurrentTime = 0;
|
clock.CurrentTime = 0;
|
||||||
note.OnPressed(new KeyBindingPressEvent<ManiaAction>(GetContainingInputManager().CurrentState, ManiaAction.Key1));
|
note.OnPressed(new KeyBindingPressEvent<ManiaAction>(GetContainingInputManager()!.CurrentState, ManiaAction.Key1));
|
||||||
});
|
});
|
||||||
AddStep("progress time", () => clock.CurrentTime = 500);
|
AddStep("progress time", () => clock.CurrentTime = 500);
|
||||||
AddAssert("head is visible", () => note.Head.Alpha == 1);
|
AddAssert("head is visible", () => note.Head.Alpha == 1);
|
||||||
|
@ -65,11 +65,8 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
|||||||
if (tmp is IFramedAnimation tmpAnimation && tmpAnimation.FrameCount > 0)
|
if (tmp is IFramedAnimation tmpAnimation && tmpAnimation.FrameCount > 0)
|
||||||
frameLength = Math.Max(1000 / 60.0, 170.0 / tmpAnimation.FrameCount);
|
frameLength = Math.Max(1000 / 60.0, 170.0 / tmpAnimation.FrameCount);
|
||||||
|
|
||||||
light = skin.GetAnimation(lightImage, true, true, frameLength: frameLength).With(d =>
|
light = skin.GetAnimation(lightImage, true, true, frameLength: frameLength)?.With(d =>
|
||||||
{
|
{
|
||||||
if (d == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
d.Origin = Anchor.Centre;
|
d.Origin = Anchor.Centre;
|
||||||
d.Blending = BlendingParameters.Additive;
|
d.Blending = BlendingParameters.Additive;
|
||||||
d.Scale = new Vector2(lightScale);
|
d.Scale = new Vector2(lightScale);
|
||||||
@ -91,11 +88,8 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
|||||||
direction.BindTo(scrollingInfo.Direction);
|
direction.BindTo(scrollingInfo.Direction);
|
||||||
isHitting.BindTo(holdNote.IsHitting);
|
isHitting.BindTo(holdNote.IsHitting);
|
||||||
|
|
||||||
bodySprite = skin.GetAnimation(imageName, wrapMode, wrapMode, true, true, frameLength: 30).With(d =>
|
bodySprite = skin.GetAnimation(imageName, wrapMode, wrapMode, true, true, frameLength: 30)?.With(d =>
|
||||||
{
|
{
|
||||||
if (d == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (d is TextureAnimation animation)
|
if (d is TextureAnimation animation)
|
||||||
animation.IsPlaying = false;
|
animation.IsPlaying = false;
|
||||||
|
|
||||||
|
@ -43,11 +43,8 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
|||||||
if (tmp is IFramedAnimation tmpAnimation && tmpAnimation.FrameCount > 0)
|
if (tmp is IFramedAnimation tmpAnimation && tmpAnimation.FrameCount > 0)
|
||||||
frameLength = Math.Max(1000 / 60.0, 170.0 / tmpAnimation.FrameCount);
|
frameLength = Math.Max(1000 / 60.0, 170.0 / tmpAnimation.FrameCount);
|
||||||
|
|
||||||
explosion = skin.GetAnimation(imageName, true, false, frameLength: frameLength).With(d =>
|
explosion = skin.GetAnimation(imageName, true, false, frameLength: frameLength)?.With(d =>
|
||||||
{
|
{
|
||||||
if (d == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
d.Origin = Anchor.Centre;
|
d.Origin = Anchor.Centre;
|
||||||
d.Blending = BlendingParameters.Additive;
|
d.Blending = BlendingParameters.Additive;
|
||||||
d.Scale = new Vector2(explosionScale);
|
d.Scale = new Vector2(explosionScale);
|
||||||
|
@ -28,13 +28,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
|||||||
string bottomImage = skin.GetManiaSkinConfig<string>(LegacyManiaSkinConfigurationLookups.BottomStageImage)?.Value
|
string bottomImage = skin.GetManiaSkinConfig<string>(LegacyManiaSkinConfigurationLookups.BottomStageImage)?.Value
|
||||||
?? "mania-stage-bottom";
|
?? "mania-stage-bottom";
|
||||||
|
|
||||||
sprite = skin.GetAnimation(bottomImage, true, true)?.With(d =>
|
sprite = skin.GetAnimation(bottomImage, true, true)?.With(d => d.Scale = new Vector2(1.6f));
|
||||||
{
|
|
||||||
if (d == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
d.Scale = new Vector2(1.6f);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (sprite != null)
|
if (sprite != null)
|
||||||
InternalChild = sprite;
|
InternalChild = sprite;
|
||||||
|
@ -133,7 +133,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
|
|||||||
Autoplay = false,
|
Autoplay = false,
|
||||||
Beatmap = new Beatmap
|
Beatmap = new Beatmap
|
||||||
{
|
{
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(500, 2000),
|
new BreakPeriod(500, 2000),
|
||||||
},
|
},
|
||||||
|
@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
|
|||||||
StartTime = 5000,
|
StartTime = 5000,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(2000, 4000),
|
new BreakPeriod(2000, 4000),
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
|
|||||||
Autoplay = false,
|
Autoplay = false,
|
||||||
Beatmap = new Beatmap
|
Beatmap = new Beatmap
|
||||||
{
|
{
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(500, 2000),
|
new BreakPeriod(500, 2000),
|
||||||
},
|
},
|
||||||
|
@ -161,9 +161,9 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
pressed = value;
|
pressed = value;
|
||||||
if (value)
|
if (value)
|
||||||
OnPressed(new KeyBindingPressEvent<OsuAction>(GetContainingInputManager().CurrentState, OsuAction.LeftButton));
|
OnPressed(new KeyBindingPressEvent<OsuAction>(GetContainingInputManager()!.CurrentState, OsuAction.LeftButton));
|
||||||
else
|
else
|
||||||
OnReleased(new KeyBindingReleaseEvent<OsuAction>(GetContainingInputManager().CurrentState, OsuAction.LeftButton));
|
OnReleased(new KeyBindingReleaseEvent<OsuAction>(GetContainingInputManager()!.CurrentState, OsuAction.LeftButton));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
private void scheduleHit() => AddStep("schedule action", () =>
|
private void scheduleHit() => AddStep("schedule action", () =>
|
||||||
{
|
{
|
||||||
double delay = hitCircle.StartTime - hitCircle.HitWindows.WindowFor(HitResult.Great) - Time.Current;
|
double delay = hitCircle.StartTime - hitCircle.HitWindows.WindowFor(HitResult.Great) - Time.Current;
|
||||||
Scheduler.AddDelayed(() => hitAreaReceptor.OnPressed(new KeyBindingPressEvent<OsuAction>(GetContainingInputManager().CurrentState, OsuAction.LeftButton)), delay);
|
Scheduler.AddDelayed(() => hitAreaReceptor.OnPressed(new KeyBindingPressEvent<OsuAction>(GetContainingInputManager()!.CurrentState, OsuAction.LeftButton)), delay);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,6 +156,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
{
|
{
|
||||||
slider = (DrawableSlider)createSlider(repeats: 1);
|
slider = (DrawableSlider)createSlider(repeats: 1);
|
||||||
Add(slider);
|
Add(slider);
|
||||||
|
slider.HitObject.NodeSamples.Clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("change samples", () => slider.HitObject.Samples = new[]
|
AddStep("change samples", () => slider.HitObject.Samples = new[]
|
||||||
|
@ -2,10 +2,13 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions.ObjectExtensions;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Screens.Edit;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit
|
namespace osu.Game.Rulesets.Osu.Edit
|
||||||
@ -23,12 +26,32 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
|
|
||||||
private partial class OsuEditorPlayfield : OsuPlayfield
|
private partial class OsuEditorPlayfield : OsuPlayfield
|
||||||
{
|
{
|
||||||
|
[Resolved]
|
||||||
|
private EditorBeatmap editorBeatmap { get; set; } = null!;
|
||||||
|
|
||||||
protected override GameplayCursorContainer? CreateCursor() => null;
|
protected override GameplayCursorContainer? CreateCursor() => null;
|
||||||
|
|
||||||
public OsuEditorPlayfield()
|
public OsuEditorPlayfield()
|
||||||
{
|
{
|
||||||
HitPolicy = new AnyOrderHitPolicy();
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -252,6 +252,8 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
|
|
||||||
protected void UpdateNestedSamples()
|
protected void UpdateNestedSamples()
|
||||||
{
|
{
|
||||||
|
this.PopulateNodeSamples();
|
||||||
|
|
||||||
// TODO: remove this when guaranteed sort is present for samples (https://github.com/ppy/osu/issues/1933)
|
// TODO: remove this when guaranteed sort is present for samples (https://github.com/ppy/osu/issues/1933)
|
||||||
HitSampleInfo tickSample = (Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL) ?? Samples.FirstOrDefault())?.With("slidertick");
|
HitSampleInfo tickSample = (Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL) ?? Samples.FirstOrDefault())?.With("slidertick");
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Objects.Legacy;
|
||||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||||
using osu.Game.Rulesets.Osu.Configuration;
|
using osu.Game.Rulesets.Osu.Configuration;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
@ -27,6 +28,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
[Cached]
|
[Cached]
|
||||||
public partial class OsuPlayfield : Playfield
|
public partial class OsuPlayfield : Playfield
|
||||||
{
|
{
|
||||||
|
private readonly Container borderContainer;
|
||||||
private readonly PlayfieldBorder playfieldBorder;
|
private readonly PlayfieldBorder playfieldBorder;
|
||||||
private readonly ProxyContainer approachCircles;
|
private readonly ProxyContainer approachCircles;
|
||||||
private readonly ProxyContainer spinnerProxies;
|
private readonly ProxyContainer spinnerProxies;
|
||||||
@ -54,7 +56,11 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
playfieldBorder = new PlayfieldBorder { RelativeSizeAxes = Axes.Both },
|
borderContainer = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = playfieldBorder = new PlayfieldBorder { RelativeSizeAxes = Axes.Both },
|
||||||
|
},
|
||||||
Smoke = new SmokeContainer { RelativeSizeAxes = Axes.Both },
|
Smoke = new SmokeContainer { RelativeSizeAxes = Axes.Both },
|
||||||
spinnerProxies = new ProxyContainer { RelativeSizeAxes = Axes.Both },
|
spinnerProxies = new ProxyContainer { RelativeSizeAxes = Axes.Both },
|
||||||
FollowPoints = new FollowPointRenderer { RelativeSizeAxes = Axes.Both },
|
FollowPoints = new FollowPointRenderer { RelativeSizeAxes = Axes.Both },
|
||||||
@ -151,6 +157,14 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
RegisterPool<Spinner, DrawableSpinner>(2, 20);
|
RegisterPool<Spinner, DrawableSpinner>(2, 20);
|
||||||
RegisterPool<SpinnerTick, DrawableSpinnerTick>(10, 200);
|
RegisterPool<SpinnerTick, DrawableSpinnerTick>(10, 200);
|
||||||
RegisterPool<SpinnerBonusTick, DrawableSpinnerBonusTick>(10, 200);
|
RegisterPool<SpinnerBonusTick, DrawableSpinnerBonusTick>(10, 200);
|
||||||
|
|
||||||
|
if (beatmap != null)
|
||||||
|
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);
|
protected override HitObjectLifetimeEntry CreateLifetimeEntry(HitObject hitObject) => new OsuHitObjectLifetimeEntry(hitObject);
|
||||||
|
@ -85,6 +85,42 @@ namespace osu.Game.Rulesets.Taiko.Tests.Judgements
|
|||||||
AssertResult<Swell>(0, HitResult.IgnoreMiss);
|
AssertResult<Swell>(0, HitResult.IgnoreMiss);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAlternatingIsRequired()
|
||||||
|
{
|
||||||
|
const double hit_time = 1000;
|
||||||
|
|
||||||
|
Swell swell = new Swell
|
||||||
|
{
|
||||||
|
StartTime = hit_time,
|
||||||
|
Duration = 1000,
|
||||||
|
RequiredHits = 10
|
||||||
|
};
|
||||||
|
|
||||||
|
List<ReplayFrame> frames = new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TaikoReplayFrame(0),
|
||||||
|
new TaikoReplayFrame(2001),
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < swell.RequiredHits; i++)
|
||||||
|
{
|
||||||
|
double frameTime = 1000 + i * 50;
|
||||||
|
frames.Add(new TaikoReplayFrame(frameTime, TaikoAction.LeftCentre));
|
||||||
|
frames.Add(new TaikoReplayFrame(frameTime + 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
PerformTest(frames, CreateBeatmap(swell));
|
||||||
|
|
||||||
|
AssertJudgementCount(11);
|
||||||
|
|
||||||
|
AssertResult<SwellTick>(0, HitResult.IgnoreHit);
|
||||||
|
for (int i = 1; i < swell.RequiredHits; i++)
|
||||||
|
AssertResult<SwellTick>(i, HitResult.IgnoreMiss);
|
||||||
|
|
||||||
|
AssertResult<Swell>(0, HitResult.IgnoreMiss);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestHitNoneSwell()
|
public void TestHitNoneSwell()
|
||||||
{
|
{
|
||||||
|
46
osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModRelax.cs
Normal file
46
osu.Game.Rulesets.Taiko.Tests/Mods/TestSceneTaikoModRelax.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// 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.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Rulesets.Taiko.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Taiko.Mods;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
using osu.Game.Rulesets.Taiko.Replays;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Tests.Mods
|
||||||
|
{
|
||||||
|
public partial class TestSceneTaikoModRelax : TaikoModTestScene
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestRelax()
|
||||||
|
{
|
||||||
|
var beatmap = new TaikoBeatmap
|
||||||
|
{
|
||||||
|
HitObjects =
|
||||||
|
{
|
||||||
|
new Hit { StartTime = 0, Type = HitType.Centre, },
|
||||||
|
new Hit { StartTime = 250, Type = HitType.Rim, },
|
||||||
|
new DrumRoll { StartTime = 500, Duration = 500, },
|
||||||
|
new Swell { StartTime = 1250, Duration = 500 },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
foreach (var ho in beatmap.HitObjects)
|
||||||
|
ho.ApplyDefaults(beatmap.ControlPointInfo, beatmap.Difficulty);
|
||||||
|
|
||||||
|
var replay = new TaikoAutoGenerator(beatmap).Generate();
|
||||||
|
|
||||||
|
foreach (var frame in replay.Frames.OfType<TaikoReplayFrame>().Where(r => r.Actions.Any()))
|
||||||
|
frame.Actions = [TaikoAction.LeftCentre];
|
||||||
|
|
||||||
|
CreateModTest(new ModTestData
|
||||||
|
{
|
||||||
|
Mod = new TaikoModRelax(),
|
||||||
|
Beatmap = beatmap,
|
||||||
|
ReplayFrames = replay.Frames,
|
||||||
|
Autoplay = false,
|
||||||
|
PassCondition = () => Player.ScoreProcessor.HasCompleted.Value && Player.ScoreProcessor.Accuracy.Value == 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -177,7 +177,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
|
|||||||
Autoplay = false,
|
Autoplay = false,
|
||||||
Beatmap = new Beatmap
|
Beatmap = new Beatmap
|
||||||
{
|
{
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(100, 1600),
|
new BreakPeriod(100, 1600),
|
||||||
},
|
},
|
||||||
|
@ -5,13 +5,34 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Mods
|
namespace osu.Game.Rulesets.Taiko.Mods
|
||||||
{
|
{
|
||||||
public class TaikoModRelax : ModRelax
|
public class TaikoModRelax : ModRelax, IApplicableToDrawableHitObject
|
||||||
{
|
{
|
||||||
public override LocalisableString Description => @"No ninja-like spinners, demanding drumrolls or unexpected katus.";
|
public override LocalisableString Description => @"No need to remember which key is correct anymore!";
|
||||||
|
|
||||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(TaikoModSingleTap) }).ToArray();
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(TaikoModSingleTap) }).ToArray();
|
||||||
|
|
||||||
|
public void ApplyToDrawableHitObject(DrawableHitObject drawable)
|
||||||
|
{
|
||||||
|
var allActions = Enum.GetValues<TaikoAction>();
|
||||||
|
|
||||||
|
drawable.HitObjectApplied += dho =>
|
||||||
|
{
|
||||||
|
switch (dho)
|
||||||
|
{
|
||||||
|
case DrawableHit hit:
|
||||||
|
hit.HitActions = allActions;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DrawableSwell swell:
|
||||||
|
swell.MustAlternate = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of keys which can result in hits for this HitObject.
|
/// A list of keys which can result in hits for this HitObject.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TaikoAction[] HitActions { get; private set; }
|
public TaikoAction[] HitActions { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The action that caused this <see cref="DrawableHit"/> to be hit.
|
/// The action that caused this <see cref="DrawableHit"/> to be hit.
|
||||||
|
@ -43,6 +43,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
|
|
||||||
public override bool DisplayResult => false;
|
public override bool DisplayResult => false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the player must alternate centre and rim hits.
|
||||||
|
/// </summary>
|
||||||
|
public bool MustAlternate { get; internal set; } = true;
|
||||||
|
|
||||||
public DrawableSwell()
|
public DrawableSwell()
|
||||||
: this(null)
|
: this(null)
|
||||||
{
|
{
|
||||||
@ -292,7 +297,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
bool isCentre = e.Action == TaikoAction.LeftCentre || e.Action == TaikoAction.RightCentre;
|
bool isCentre = e.Action == TaikoAction.LeftCentre || e.Action == TaikoAction.RightCentre;
|
||||||
|
|
||||||
// Ensure alternating centre and rim hits
|
// Ensure alternating centre and rim hits
|
||||||
if (lastWasCentre == isCentre)
|
if (lastWasCentre == isCentre && MustAlternate)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// If we've already successfully judged a tick this frame, do not judge more.
|
// If we've already successfully judged a tick this frame, do not judge more.
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -29,7 +28,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
{
|
{
|
||||||
var beatmap = new Beatmap<HitObject>
|
var beatmap = new Beatmap<HitObject>
|
||||||
{
|
{
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(0, 649)
|
new BreakPeriod(0, 649)
|
||||||
}
|
}
|
||||||
@ -52,7 +51,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
new HitCircle { StartTime = 0 },
|
new HitCircle { StartTime = 0 },
|
||||||
new HitCircle { StartTime = 1_200 }
|
new HitCircle { StartTime = 1_200 }
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(100, 751)
|
new BreakPeriod(100, 751)
|
||||||
}
|
}
|
||||||
@ -75,7 +74,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
new HitCircle { StartTime = 0 },
|
new HitCircle { StartTime = 0 },
|
||||||
new HitCircle { StartTime = 1_298 }
|
new HitCircle { StartTime = 1_298 }
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(200, 850)
|
new BreakPeriod(200, 850)
|
||||||
}
|
}
|
||||||
@ -98,7 +97,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
new HitCircle { StartTime = 0 },
|
new HitCircle { StartTime = 0 },
|
||||||
new HitCircle { StartTime = 1200 }
|
new HitCircle { StartTime = 1200 }
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(1398, 2300)
|
new BreakPeriod(1398, 2300)
|
||||||
}
|
}
|
||||||
@ -121,7 +120,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
new HitCircle { StartTime = 1100 },
|
new HitCircle { StartTime = 1100 },
|
||||||
new HitCircle { StartTime = 1500 }
|
new HitCircle { StartTime = 1500 }
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(0, 652)
|
new BreakPeriod(0, 652)
|
||||||
}
|
}
|
||||||
@ -145,7 +144,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
new HitCircle { StartTime = 1_297 },
|
new HitCircle { StartTime = 1_297 },
|
||||||
new HitCircle { StartTime = 1_298 }
|
new HitCircle { StartTime = 1_298 }
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(200, 850)
|
new BreakPeriod(200, 850)
|
||||||
}
|
}
|
||||||
@ -168,7 +167,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
new HitCircle { StartTime = 0 },
|
new HitCircle { StartTime = 0 },
|
||||||
new HitCircle { StartTime = 1_300 }
|
new HitCircle { StartTime = 1_300 }
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(200, 850)
|
new BreakPeriod(200, 850)
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
new HitCircle { StartTime = 0 },
|
new HitCircle { StartTime = 0 },
|
||||||
new HitCircle { StartTime = 40_000 }
|
new HitCircle { StartTime = 40_000 }
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(10_000, 21_000)
|
new BreakPeriod(10_000, 21_000)
|
||||||
}
|
}
|
||||||
|
300
osu.Game.Tests/Editing/TestSceneEditorBeatmapProcessor.cs
Normal file
300
osu.Game.Tests/Editing/TestSceneEditorBeatmapProcessor.cs
Normal file
@ -0,0 +1,300 @@
|
|||||||
|
// 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 NUnit.Framework;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Beatmaps.Timing;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Screens.Edit;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Editing
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestSceneEditorBeatmapProcessor
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestEmptyBeatmap()
|
||||||
|
{
|
||||||
|
var controlPoints = new ControlPointInfo();
|
||||||
|
controlPoints.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||||
|
var beatmap = new Beatmap
|
||||||
|
{
|
||||||
|
ControlPointInfo = controlPoints,
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmapProcessor = new EditorBeatmapProcessor(beatmap, new OsuRuleset());
|
||||||
|
beatmapProcessor.PreProcess();
|
||||||
|
beatmapProcessor.PostProcess();
|
||||||
|
|
||||||
|
Assert.That(beatmap.Breaks, Is.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSingleObjectBeatmap()
|
||||||
|
{
|
||||||
|
var controlPoints = new ControlPointInfo();
|
||||||
|
controlPoints.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||||
|
var beatmap = new Beatmap
|
||||||
|
{
|
||||||
|
ControlPointInfo = controlPoints,
|
||||||
|
HitObjects =
|
||||||
|
{
|
||||||
|
new HitCircle { StartTime = 1000 },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmapProcessor = new EditorBeatmapProcessor(beatmap, new OsuRuleset());
|
||||||
|
beatmapProcessor.PreProcess();
|
||||||
|
beatmapProcessor.PostProcess();
|
||||||
|
|
||||||
|
Assert.That(beatmap.Breaks, Is.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestTwoObjectsCloseTogether()
|
||||||
|
{
|
||||||
|
var controlPoints = new ControlPointInfo();
|
||||||
|
controlPoints.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||||
|
var beatmap = new Beatmap
|
||||||
|
{
|
||||||
|
ControlPointInfo = controlPoints,
|
||||||
|
HitObjects =
|
||||||
|
{
|
||||||
|
new HitCircle { StartTime = 1000 },
|
||||||
|
new HitCircle { StartTime = 2000 },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmapProcessor = new EditorBeatmapProcessor(beatmap, new OsuRuleset());
|
||||||
|
beatmapProcessor.PreProcess();
|
||||||
|
beatmapProcessor.PostProcess();
|
||||||
|
|
||||||
|
Assert.That(beatmap.Breaks, Is.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestTwoObjectsFarApart()
|
||||||
|
{
|
||||||
|
var controlPoints = new ControlPointInfo();
|
||||||
|
controlPoints.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||||
|
var beatmap = new Beatmap
|
||||||
|
{
|
||||||
|
ControlPointInfo = controlPoints,
|
||||||
|
HitObjects =
|
||||||
|
{
|
||||||
|
new HitCircle { StartTime = 1000 },
|
||||||
|
new HitCircle { StartTime = 5000 },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmapProcessor = new EditorBeatmapProcessor(beatmap, new OsuRuleset());
|
||||||
|
beatmapProcessor.PreProcess();
|
||||||
|
beatmapProcessor.PostProcess();
|
||||||
|
|
||||||
|
Assert.Multiple(() =>
|
||||||
|
{
|
||||||
|
Assert.That(beatmap.Breaks, Has.Count.EqualTo(1));
|
||||||
|
Assert.That(beatmap.Breaks[0].StartTime, Is.EqualTo(1200));
|
||||||
|
Assert.That(beatmap.Breaks[0].EndTime, Is.EqualTo(4000));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestBreaksAreFused()
|
||||||
|
{
|
||||||
|
var controlPoints = new ControlPointInfo();
|
||||||
|
controlPoints.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||||
|
var beatmap = new Beatmap
|
||||||
|
{
|
||||||
|
ControlPointInfo = controlPoints,
|
||||||
|
HitObjects =
|
||||||
|
{
|
||||||
|
new HitCircle { StartTime = 1000 },
|
||||||
|
new HitCircle { StartTime = 9000 },
|
||||||
|
},
|
||||||
|
Breaks =
|
||||||
|
{
|
||||||
|
new BreakPeriod(1200, 4000),
|
||||||
|
new BreakPeriod(5200, 8000),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmapProcessor = new EditorBeatmapProcessor(beatmap, new OsuRuleset());
|
||||||
|
beatmapProcessor.PreProcess();
|
||||||
|
beatmapProcessor.PostProcess();
|
||||||
|
|
||||||
|
Assert.Multiple(() =>
|
||||||
|
{
|
||||||
|
Assert.That(beatmap.Breaks, Has.Count.EqualTo(1));
|
||||||
|
Assert.That(beatmap.Breaks[0].StartTime, Is.EqualTo(1200));
|
||||||
|
Assert.That(beatmap.Breaks[0].EndTime, Is.EqualTo(8000));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestBreaksAreSplit()
|
||||||
|
{
|
||||||
|
var controlPoints = new ControlPointInfo();
|
||||||
|
controlPoints.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||||
|
var beatmap = new Beatmap
|
||||||
|
{
|
||||||
|
ControlPointInfo = controlPoints,
|
||||||
|
HitObjects =
|
||||||
|
{
|
||||||
|
new HitCircle { StartTime = 1000 },
|
||||||
|
new HitCircle { StartTime = 5000 },
|
||||||
|
new HitCircle { StartTime = 9000 },
|
||||||
|
},
|
||||||
|
Breaks =
|
||||||
|
{
|
||||||
|
new BreakPeriod(1200, 8000),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmapProcessor = new EditorBeatmapProcessor(beatmap, new OsuRuleset());
|
||||||
|
beatmapProcessor.PreProcess();
|
||||||
|
beatmapProcessor.PostProcess();
|
||||||
|
|
||||||
|
Assert.Multiple(() =>
|
||||||
|
{
|
||||||
|
Assert.That(beatmap.Breaks, Has.Count.EqualTo(2));
|
||||||
|
Assert.That(beatmap.Breaks[0].StartTime, Is.EqualTo(1200));
|
||||||
|
Assert.That(beatmap.Breaks[0].EndTime, Is.EqualTo(4000));
|
||||||
|
Assert.That(beatmap.Breaks[1].StartTime, Is.EqualTo(5200));
|
||||||
|
Assert.That(beatmap.Breaks[1].EndTime, Is.EqualTo(8000));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestBreaksAreNudged()
|
||||||
|
{
|
||||||
|
var controlPoints = new ControlPointInfo();
|
||||||
|
controlPoints.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||||
|
var beatmap = new Beatmap
|
||||||
|
{
|
||||||
|
ControlPointInfo = controlPoints,
|
||||||
|
HitObjects =
|
||||||
|
{
|
||||||
|
new HitCircle { StartTime = 1100 },
|
||||||
|
new HitCircle { StartTime = 9000 },
|
||||||
|
},
|
||||||
|
Breaks =
|
||||||
|
{
|
||||||
|
new BreakPeriod(1200, 8000),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmapProcessor = new EditorBeatmapProcessor(beatmap, new OsuRuleset());
|
||||||
|
beatmapProcessor.PreProcess();
|
||||||
|
beatmapProcessor.PostProcess();
|
||||||
|
|
||||||
|
Assert.Multiple(() =>
|
||||||
|
{
|
||||||
|
Assert.That(beatmap.Breaks, Has.Count.EqualTo(1));
|
||||||
|
Assert.That(beatmap.Breaks[0].StartTime, Is.EqualTo(1300));
|
||||||
|
Assert.That(beatmap.Breaks[0].EndTime, Is.EqualTo(8000));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestManualBreaksAreNotFused()
|
||||||
|
{
|
||||||
|
var controlPoints = new ControlPointInfo();
|
||||||
|
controlPoints.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||||
|
var beatmap = new Beatmap
|
||||||
|
{
|
||||||
|
ControlPointInfo = controlPoints,
|
||||||
|
HitObjects =
|
||||||
|
{
|
||||||
|
new HitCircle { StartTime = 1000 },
|
||||||
|
new HitCircle { StartTime = 9000 },
|
||||||
|
},
|
||||||
|
Breaks =
|
||||||
|
{
|
||||||
|
new ManualBreakPeriod(1200, 4000),
|
||||||
|
new ManualBreakPeriod(5200, 8000),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmapProcessor = new EditorBeatmapProcessor(beatmap, new OsuRuleset());
|
||||||
|
beatmapProcessor.PreProcess();
|
||||||
|
beatmapProcessor.PostProcess();
|
||||||
|
|
||||||
|
Assert.Multiple(() =>
|
||||||
|
{
|
||||||
|
Assert.That(beatmap.Breaks, Has.Count.EqualTo(2));
|
||||||
|
Assert.That(beatmap.Breaks[0].StartTime, Is.EqualTo(1200));
|
||||||
|
Assert.That(beatmap.Breaks[0].EndTime, Is.EqualTo(4000));
|
||||||
|
Assert.That(beatmap.Breaks[1].StartTime, Is.EqualTo(5200));
|
||||||
|
Assert.That(beatmap.Breaks[1].EndTime, Is.EqualTo(8000));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestManualBreaksAreSplit()
|
||||||
|
{
|
||||||
|
var controlPoints = new ControlPointInfo();
|
||||||
|
controlPoints.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||||
|
var beatmap = new Beatmap
|
||||||
|
{
|
||||||
|
ControlPointInfo = controlPoints,
|
||||||
|
HitObjects =
|
||||||
|
{
|
||||||
|
new HitCircle { StartTime = 1000 },
|
||||||
|
new HitCircle { StartTime = 5000 },
|
||||||
|
new HitCircle { StartTime = 9000 },
|
||||||
|
},
|
||||||
|
Breaks =
|
||||||
|
{
|
||||||
|
new ManualBreakPeriod(1200, 8000),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmapProcessor = new EditorBeatmapProcessor(beatmap, new OsuRuleset());
|
||||||
|
beatmapProcessor.PreProcess();
|
||||||
|
beatmapProcessor.PostProcess();
|
||||||
|
|
||||||
|
Assert.Multiple(() =>
|
||||||
|
{
|
||||||
|
Assert.That(beatmap.Breaks, Has.Count.EqualTo(2));
|
||||||
|
Assert.That(beatmap.Breaks[0].StartTime, Is.EqualTo(1200));
|
||||||
|
Assert.That(beatmap.Breaks[0].EndTime, Is.EqualTo(4000));
|
||||||
|
Assert.That(beatmap.Breaks[1].StartTime, Is.EqualTo(5200));
|
||||||
|
Assert.That(beatmap.Breaks[1].EndTime, Is.EqualTo(8000));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestManualBreaksAreNotNudged()
|
||||||
|
{
|
||||||
|
var controlPoints = new ControlPointInfo();
|
||||||
|
controlPoints.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||||
|
var beatmap = new Beatmap
|
||||||
|
{
|
||||||
|
ControlPointInfo = controlPoints,
|
||||||
|
HitObjects =
|
||||||
|
{
|
||||||
|
new HitCircle { StartTime = 1000 },
|
||||||
|
new HitCircle { StartTime = 9000 },
|
||||||
|
},
|
||||||
|
Breaks =
|
||||||
|
{
|
||||||
|
new ManualBreakPeriod(1200, 8800),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmapProcessor = new EditorBeatmapProcessor(beatmap, new OsuRuleset());
|
||||||
|
beatmapProcessor.PreProcess();
|
||||||
|
beatmapProcessor.PostProcess();
|
||||||
|
|
||||||
|
Assert.Multiple(() =>
|
||||||
|
{
|
||||||
|
Assert.That(beatmap.Breaks, Has.Count.EqualTo(1));
|
||||||
|
Assert.That(beatmap.Breaks[0].StartTime, Is.EqualTo(1200));
|
||||||
|
Assert.That(beatmap.Breaks[0].EndTime, Is.EqualTo(8800));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
// 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 NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions.ObjectExtensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Screens.OnlinePlay.DailyChallenge;
|
||||||
|
using osu.Game.Tests.Resources;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.DailyChallenge
|
||||||
|
{
|
||||||
|
public partial class TestSceneDailyChallengeEventFeed : OsuTestScene
|
||||||
|
{
|
||||||
|
[Cached]
|
||||||
|
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Plum);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestBasicAppearance()
|
||||||
|
{
|
||||||
|
DailyChallengeEventFeed feed = null!;
|
||||||
|
|
||||||
|
AddStep("create content", () => Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colourProvider.Background4,
|
||||||
|
},
|
||||||
|
feed = new DailyChallengeEventFeed
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AddSliderStep("adjust width", 0.1f, 1, 1, width =>
|
||||||
|
{
|
||||||
|
if (feed.IsNotNull())
|
||||||
|
feed.Width = width;
|
||||||
|
});
|
||||||
|
AddSliderStep("adjust height", 0.1f, 1, 1, height =>
|
||||||
|
{
|
||||||
|
if (feed.IsNotNull())
|
||||||
|
feed.Height = height;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("add normal score", () =>
|
||||||
|
{
|
||||||
|
var testScore = TestResources.CreateTestScoreInfo();
|
||||||
|
testScore.TotalScore = RNG.Next(1_000_000);
|
||||||
|
|
||||||
|
feed.AddNewScore(new DailyChallengeEventFeed.NewScoreEvent(testScore, null));
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("add new user best", () =>
|
||||||
|
{
|
||||||
|
var testScore = TestResources.CreateTestScoreInfo();
|
||||||
|
testScore.TotalScore = RNG.Next(1_000_000);
|
||||||
|
|
||||||
|
feed.AddNewScore(new DailyChallengeEventFeed.NewScoreEvent(testScore, RNG.Next(1, 1000)));
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("add top 10 score", () =>
|
||||||
|
{
|
||||||
|
var testScore = TestResources.CreateTestScoreInfo();
|
||||||
|
testScore.TotalScore = RNG.Next(1_000_000);
|
||||||
|
|
||||||
|
feed.AddNewScore(new DailyChallengeEventFeed.NewScoreEvent(testScore, RNG.Next(1, 10)));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,10 +4,12 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Tests.Beatmaps;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Editing
|
namespace osu.Game.Tests.Visual.Editing
|
||||||
{
|
{
|
||||||
@ -15,6 +17,8 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
{
|
{
|
||||||
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
||||||
|
|
||||||
|
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(ruleset, false);
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestSelectedObjects()
|
public void TestSelectedObjects()
|
||||||
{
|
{
|
||||||
|
@ -13,9 +13,12 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
using osu.Game.Graphics.UserInterfaceV2;
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
|
using osu.Game.Screens.Edit.Components.TernaryButtons;
|
||||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||||
using osu.Game.Screens.Edit.Timing;
|
using osu.Game.Screens.Edit.Timing;
|
||||||
using osu.Game.Tests.Beatmaps;
|
using osu.Game.Tests.Beatmaps;
|
||||||
@ -79,10 +82,10 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestPopoverHasFocus()
|
public void TestPopoverHasNoFocus()
|
||||||
{
|
{
|
||||||
clickSamplePiece(0);
|
clickSamplePiece(0);
|
||||||
samplePopoverHasFocus();
|
samplePopoverHasNoFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -226,6 +229,84 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
samplePopoverHasSingleBank(HitSampleInfo.BANK_NORMAL);
|
samplePopoverHasSingleBank(HitSampleInfo.BANK_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestPopoverAddSampleAddition()
|
||||||
|
{
|
||||||
|
clickSamplePiece(0);
|
||||||
|
|
||||||
|
setBankViaPopover(HitSampleInfo.BANK_SOFT);
|
||||||
|
hitObjectHasSampleBank(0, HitSampleInfo.BANK_SOFT);
|
||||||
|
|
||||||
|
toggleAdditionViaPopover(0);
|
||||||
|
|
||||||
|
hitObjectHasSampleBank(0, HitSampleInfo.BANK_SOFT);
|
||||||
|
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_WHISTLE);
|
||||||
|
|
||||||
|
setAdditionBankViaPopover(HitSampleInfo.BANK_DRUM);
|
||||||
|
|
||||||
|
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_SOFT);
|
||||||
|
hitObjectHasSampleAdditionBank(0, HitSampleInfo.BANK_DRUM);
|
||||||
|
|
||||||
|
toggleAdditionViaPopover(0);
|
||||||
|
|
||||||
|
hitObjectHasSampleBank(0, HitSampleInfo.BANK_SOFT);
|
||||||
|
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNodeSamplePopover()
|
||||||
|
{
|
||||||
|
AddStep("add slider", () =>
|
||||||
|
{
|
||||||
|
EditorBeatmap.Clear();
|
||||||
|
EditorBeatmap.Add(new Slider
|
||||||
|
{
|
||||||
|
Position = new Vector2(256, 256),
|
||||||
|
StartTime = 0,
|
||||||
|
Path = new SliderPath(new[] { new PathControlPoint(Vector2.Zero), new PathControlPoint(new Vector2(250, 0)) }),
|
||||||
|
Samples =
|
||||||
|
{
|
||||||
|
new HitSampleInfo(HitSampleInfo.HIT_NORMAL)
|
||||||
|
},
|
||||||
|
NodeSamples =
|
||||||
|
{
|
||||||
|
new List<HitSampleInfo> { new HitSampleInfo(HitSampleInfo.HIT_NORMAL) },
|
||||||
|
new List<HitSampleInfo> { new HitSampleInfo(HitSampleInfo.HIT_NORMAL) },
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
clickNodeSamplePiece(0, 1);
|
||||||
|
|
||||||
|
setBankViaPopover(HitSampleInfo.BANK_SOFT);
|
||||||
|
hitObjectNodeHasSampleBank(0, 0, HitSampleInfo.BANK_NORMAL);
|
||||||
|
hitObjectNodeHasSampleBank(0, 1, HitSampleInfo.BANK_SOFT);
|
||||||
|
|
||||||
|
toggleAdditionViaPopover(0);
|
||||||
|
|
||||||
|
hitObjectNodeHasSampleBank(0, 0, HitSampleInfo.BANK_NORMAL);
|
||||||
|
hitObjectNodeHasSampleBank(0, 1, HitSampleInfo.BANK_SOFT);
|
||||||
|
hitObjectNodeHasSamples(0, 0, HitSampleInfo.HIT_NORMAL);
|
||||||
|
hitObjectNodeHasSamples(0, 1, HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_WHISTLE);
|
||||||
|
|
||||||
|
setAdditionBankViaPopover(HitSampleInfo.BANK_DRUM);
|
||||||
|
|
||||||
|
hitObjectNodeHasSampleBank(0, 0, HitSampleInfo.BANK_NORMAL);
|
||||||
|
hitObjectNodeHasSampleNormalBank(0, 1, HitSampleInfo.BANK_SOFT);
|
||||||
|
hitObjectNodeHasSampleAdditionBank(0, 1, HitSampleInfo.BANK_DRUM);
|
||||||
|
|
||||||
|
toggleAdditionViaPopover(0);
|
||||||
|
|
||||||
|
hitObjectNodeHasSampleBank(0, 1, HitSampleInfo.BANK_SOFT);
|
||||||
|
hitObjectNodeHasSamples(0, 0, HitSampleInfo.HIT_NORMAL);
|
||||||
|
hitObjectNodeHasSamples(0, 1, HitSampleInfo.HIT_NORMAL);
|
||||||
|
|
||||||
|
setVolumeViaPopover(10);
|
||||||
|
|
||||||
|
hitObjectNodeHasSampleVolume(0, 0, 100);
|
||||||
|
hitObjectNodeHasSampleVolume(0, 1, 10);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestHotkeysMultipleSelectionWithSameSampleBank()
|
public void TestHotkeysMultipleSelectionWithSameSampleBank()
|
||||||
{
|
{
|
||||||
@ -329,13 +410,21 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
InputManager.Click(MouseButton.Left);
|
InputManager.Click(MouseButton.Left);
|
||||||
});
|
});
|
||||||
|
|
||||||
private void samplePopoverHasFocus() => AddUntilStep("sample popover textbox focused", () =>
|
private void clickNodeSamplePiece(int objectIndex, int nodeIndex) => AddStep($"click {objectIndex.ToOrdinalWords()} object {nodeIndex.ToOrdinalWords()} node sample piece", () =>
|
||||||
|
{
|
||||||
|
var samplePiece = this.ChildrenOfType<NodeSamplePointPiece>().Where(piece => piece.HitObject == EditorBeatmap.HitObjects.ElementAt(objectIndex)).ToArray()[nodeIndex];
|
||||||
|
|
||||||
|
InputManager.MoveMouseTo(samplePiece);
|
||||||
|
InputManager.Click(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
private void samplePopoverHasNoFocus() => AddUntilStep("sample popover textbox not focused", () =>
|
||||||
{
|
{
|
||||||
var popover = this.ChildrenOfType<SamplePointPiece.SampleEditPopover>().SingleOrDefault();
|
var popover = this.ChildrenOfType<SamplePointPiece.SampleEditPopover>().SingleOrDefault();
|
||||||
var slider = popover?.ChildrenOfType<IndeterminateSliderWithTextBoxInput<int>>().Single();
|
var slider = popover?.ChildrenOfType<IndeterminateSliderWithTextBoxInput<int>>().Single();
|
||||||
var textbox = slider?.ChildrenOfType<OsuTextBox>().Single();
|
var textbox = slider?.ChildrenOfType<OsuTextBox>().Single();
|
||||||
|
|
||||||
return textbox?.HasFocus == true;
|
return textbox?.HasFocus == false;
|
||||||
});
|
});
|
||||||
|
|
||||||
private void samplePopoverHasSingleVolume(int volume) => AddUntilStep($"sample popover has volume {volume}", () =>
|
private void samplePopoverHasSingleVolume(int volume) => AddUntilStep($"sample popover has volume {volume}", () =>
|
||||||
@ -372,7 +461,6 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
|
|
||||||
private void dismissPopover()
|
private void dismissPopover()
|
||||||
{
|
{
|
||||||
AddStep("unfocus textbox", () => InputManager.Key(Key.Escape));
|
|
||||||
AddStep("dismiss popover", () => InputManager.Key(Key.Escape));
|
AddStep("dismiss popover", () => InputManager.Key(Key.Escape));
|
||||||
AddUntilStep("wait for dismiss", () => !this.ChildrenOfType<SamplePointPiece.SampleEditPopover>().Any(popover => popover.IsPresent));
|
AddUntilStep("wait for dismiss", () => !this.ChildrenOfType<SamplePointPiece.SampleEditPopover>().Any(popover => popover.IsPresent));
|
||||||
}
|
}
|
||||||
@ -390,6 +478,12 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
return h.Samples.All(o => o.Volume == volume);
|
return h.Samples.All(o => o.Volume == volume);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
private void hitObjectNodeHasSampleVolume(int objectIndex, int nodeIndex, int volume) => AddAssert($"{objectIndex.ToOrdinalWords()} object {nodeIndex.ToOrdinalWords()} node has volume {volume}", () =>
|
||||||
|
{
|
||||||
|
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex) as IHasRepeats;
|
||||||
|
return h is not null && h.NodeSamples[nodeIndex].All(o => o.Volume == volume);
|
||||||
|
});
|
||||||
|
|
||||||
private void setBankViaPopover(string bank) => AddStep($"set bank {bank} via popover", () =>
|
private void setBankViaPopover(string bank) => AddStep($"set bank {bank} via popover", () =>
|
||||||
{
|
{
|
||||||
var popover = this.ChildrenOfType<SamplePointPiece.SampleEditPopover>().Single();
|
var popover = this.ChildrenOfType<SamplePointPiece.SampleEditPopover>().Single();
|
||||||
@ -401,6 +495,26 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
InputManager.Key(Key.Enter);
|
InputManager.Key(Key.Enter);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
private void setAdditionBankViaPopover(string bank) => AddStep($"set addition bank {bank} via popover", () =>
|
||||||
|
{
|
||||||
|
var popover = this.ChildrenOfType<SamplePointPiece.SampleEditPopover>().Single();
|
||||||
|
var textBox = popover.ChildrenOfType<LabelledTextBox>().ToArray()[1];
|
||||||
|
textBox.Current.Value = bank;
|
||||||
|
// force a commit via keyboard.
|
||||||
|
// this is needed when testing attempting to set empty bank - which should revert to the previous value, but only on commit.
|
||||||
|
((IFocusManager)InputManager).ChangeFocus(textBox);
|
||||||
|
InputManager.Key(Key.Enter);
|
||||||
|
});
|
||||||
|
|
||||||
|
private void toggleAdditionViaPopover(int index) => AddStep($"toggle addition {index} via popover", () =>
|
||||||
|
{
|
||||||
|
var popover = this.ChildrenOfType<SamplePointPiece.SampleEditPopover>().First();
|
||||||
|
var ternaryButton = popover.ChildrenOfType<DrawableTernaryButton>().ToArray()[index];
|
||||||
|
InputManager.MoveMouseTo(ternaryButton);
|
||||||
|
InputManager.PressButton(MouseButton.Left);
|
||||||
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
private void hitObjectHasSamples(int objectIndex, params string[] samples) => AddAssert($"{objectIndex.ToOrdinalWords()} has samples {string.Join(',', samples)}", () =>
|
private void hitObjectHasSamples(int objectIndex, params string[] samples) => AddAssert($"{objectIndex.ToOrdinalWords()} has samples {string.Join(',', samples)}", () =>
|
||||||
{
|
{
|
||||||
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex);
|
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex);
|
||||||
@ -412,5 +526,41 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex);
|
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex);
|
||||||
return h.Samples.All(o => o.Bank == bank);
|
return h.Samples.All(o => o.Bank == bank);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
private void hitObjectHasSampleNormalBank(int objectIndex, string bank) => AddAssert($"{objectIndex.ToOrdinalWords()} has normal bank {bank}", () =>
|
||||||
|
{
|
||||||
|
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex);
|
||||||
|
return h.Samples.Where(o => o.Name == HitSampleInfo.HIT_NORMAL).All(o => o.Bank == bank);
|
||||||
|
});
|
||||||
|
|
||||||
|
private void hitObjectHasSampleAdditionBank(int objectIndex, string bank) => AddAssert($"{objectIndex.ToOrdinalWords()} has addition bank {bank}", () =>
|
||||||
|
{
|
||||||
|
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex);
|
||||||
|
return h.Samples.Where(o => o.Name != HitSampleInfo.HIT_NORMAL).All(o => o.Bank == bank);
|
||||||
|
});
|
||||||
|
|
||||||
|
private void hitObjectNodeHasSamples(int objectIndex, int nodeIndex, params string[] samples) => AddAssert($"{objectIndex.ToOrdinalWords()} object {nodeIndex.ToOrdinalWords()} node has samples {string.Join(',', samples)}", () =>
|
||||||
|
{
|
||||||
|
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex) as IHasRepeats;
|
||||||
|
return h is not null && h.NodeSamples[nodeIndex].Select(s => s.Name).SequenceEqual(samples);
|
||||||
|
});
|
||||||
|
|
||||||
|
private void hitObjectNodeHasSampleBank(int objectIndex, int nodeIndex, string bank) => AddAssert($"{objectIndex.ToOrdinalWords()} object {nodeIndex.ToOrdinalWords()} node has bank {bank}", () =>
|
||||||
|
{
|
||||||
|
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex) as IHasRepeats;
|
||||||
|
return h is not null && h.NodeSamples[nodeIndex].All(o => o.Bank == bank);
|
||||||
|
});
|
||||||
|
|
||||||
|
private void hitObjectNodeHasSampleNormalBank(int objectIndex, int nodeIndex, string bank) => AddAssert($"{objectIndex.ToOrdinalWords()} object {nodeIndex.ToOrdinalWords()} node has normal bank {bank}", () =>
|
||||||
|
{
|
||||||
|
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex) as IHasRepeats;
|
||||||
|
return h is not null && h.NodeSamples[nodeIndex].Where(o => o.Name == HitSampleInfo.HIT_NORMAL).All(o => o.Bank == bank);
|
||||||
|
});
|
||||||
|
|
||||||
|
private void hitObjectNodeHasSampleAdditionBank(int objectIndex, int nodeIndex, string bank) => AddAssert($"{objectIndex.ToOrdinalWords()} object {nodeIndex.ToOrdinalWords()} node has addition bank {bank}", () =>
|
||||||
|
{
|
||||||
|
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex) as IHasRepeats;
|
||||||
|
return h is not null && h.NodeSamples[nodeIndex].Where(o => o.Name != HitSampleInfo.HIT_NORMAL).All(o => o.Bank == bank);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
updatePosition(GetContainingInputManager().CurrentState.Mouse.Position);
|
updatePosition(GetContainingInputManager()!.CurrentState.Mouse.Position);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseMove(MouseMoveEvent e)
|
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -19,7 +17,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
public partial class TestSceneBeatmapOffsetControl : OsuTestScene
|
public partial class TestSceneBeatmapOffsetControl : OsuTestScene
|
||||||
{
|
{
|
||||||
private BeatmapOffsetControl offsetControl;
|
private BeatmapOffsetControl offsetControl = null!;
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
public void SetUpSteps()
|
public void SetUpSteps()
|
||||||
@ -137,5 +135,30 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddStep("Remove reference score", () => offsetControl.ReferenceScore.Value = null);
|
AddStep("Remove reference score", () => offsetControl.ReferenceScore.Value = null);
|
||||||
AddAssert("No calibration button", () => !offsetControl.ChildrenOfType<SettingsButton>().Any());
|
AddAssert("No calibration button", () => !offsetControl.ChildrenOfType<SettingsButton>().Any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestCalibrationNoChange()
|
||||||
|
{
|
||||||
|
const double average_error = 0;
|
||||||
|
|
||||||
|
AddAssert("Offset is neutral", () => offsetControl.Current.Value == 0);
|
||||||
|
AddAssert("No calibration button", () => !offsetControl.ChildrenOfType<SettingsButton>().Any());
|
||||||
|
AddStep("Set reference score", () =>
|
||||||
|
{
|
||||||
|
offsetControl.ReferenceScore.Value = new ScoreInfo
|
||||||
|
{
|
||||||
|
HitEvents = TestSceneHitEventTimingDistributionGraph.CreateDistributedHitEvents(average_error),
|
||||||
|
BeatmapInfo = Beatmap.Value.BeatmapInfo,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("Has calibration button", () => offsetControl.ChildrenOfType<SettingsButton>().Any());
|
||||||
|
AddStep("Press button", () => offsetControl.ChildrenOfType<SettingsButton>().Single().TriggerClick());
|
||||||
|
AddAssert("Offset is adjusted", () => offsetControl.Current.Value == -average_error);
|
||||||
|
|
||||||
|
AddUntilStep("Button is disabled", () => !offsetControl.ChildrenOfType<SettingsButton>().Single().Enabled.Value);
|
||||||
|
AddStep("Remove reference score", () => offsetControl.ReferenceScore.Value = null);
|
||||||
|
AddAssert("No calibration button", () => !offsetControl.ChildrenOfType<SettingsButton>().Any());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,11 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Storyboards;
|
using osu.Game.Storyboards;
|
||||||
using osu.Game.Storyboards.Drawables;
|
using osu.Game.Storyboards.Drawables;
|
||||||
|
using osu.Game.Tests.Gameplay;
|
||||||
using osu.Game.Tests.Resources;
|
using osu.Game.Tests.Resources;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -28,14 +31,14 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
private DrawableStoryboard? storyboard;
|
private DrawableStoryboard? storyboard;
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private GameplayState testGameplayState = TestGameplayState.Create(new OsuRuleset());
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestStoryboard()
|
public void TestStoryboard()
|
||||||
{
|
{
|
||||||
AddStep("Restart", restart);
|
AddStep("Restart", restart);
|
||||||
AddToggleStep("Passing", passing =>
|
AddToggleStep("Toggle passing state", passing => testGameplayState.HealthProcessor.Health.Value = passing ? 1 : 0);
|
||||||
{
|
|
||||||
if (storyboard != null) storyboard.Passing = passing;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -109,7 +112,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
storyboardContainer.Clock = new FramedClock(Beatmap.Value.Track);
|
storyboardContainer.Clock = new FramedClock(Beatmap.Value.Track);
|
||||||
|
|
||||||
storyboard = toLoad.CreateDrawable(SelectedMods.Value);
|
storyboard = toLoad.CreateDrawable(SelectedMods.Value);
|
||||||
storyboard.Passing = false;
|
|
||||||
|
|
||||||
storyboardContainer.Add(storyboard);
|
storyboardContainer.Add(storyboard);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
|||||||
editorInfo.Selected.ValueChanged += selection =>
|
editorInfo.Selected.ValueChanged += selection =>
|
||||||
{
|
{
|
||||||
// ensure any ongoing edits are committed out to the *current* selection before changing to a new one.
|
// ensure any ongoing edits are committed out to the *current* selection before changing to a new one.
|
||||||
GetContainingFocusManager().TriggerFocusContention(null);
|
GetContainingFocusManager()?.TriggerFocusContention(null);
|
||||||
|
|
||||||
// Required to avoid cyclic failure in BindableWithCurrent (TriggerChange called during the Current_Set process).
|
// Required to avoid cyclic failure in BindableWithCurrent (TriggerChange called during the Current_Set process).
|
||||||
// Arguable a framework issue but since we haven't hit it anywhere else a local workaround seems best.
|
// Arguable a framework issue but since we haven't hit it anywhere else a local workaround seems best.
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Diagnostics;
|
|
||||||
using ManagedBass.Fx;
|
using ManagedBass.Fx;
|
||||||
using osu.Framework.Audio.Mixing;
|
using osu.Framework.Audio.Mixing;
|
||||||
using osu.Framework.Caching;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Audio.Effects
|
namespace osu.Game.Audio.Effects
|
||||||
@ -26,8 +24,6 @@ namespace osu.Game.Audio.Effects
|
|||||||
private readonly BQFParameters filter;
|
private readonly BQFParameters filter;
|
||||||
private readonly BQFType type;
|
private readonly BQFType type;
|
||||||
|
|
||||||
private readonly Cached filterApplication = new Cached();
|
|
||||||
|
|
||||||
private int cutoff;
|
private int cutoff;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -42,7 +38,7 @@ namespace osu.Game.Audio.Effects
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
cutoff = value;
|
cutoff = value;
|
||||||
filterApplication.Invalidate();
|
updateFilter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,18 +60,9 @@ namespace osu.Game.Audio.Effects
|
|||||||
fQ = 0.7f
|
fQ = 0.7f
|
||||||
};
|
};
|
||||||
|
|
||||||
Cutoff = getInitialCutoff(type);
|
cutoff = getInitialCutoff(type);
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
updateFilter();
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
if (!filterApplication.IsValid)
|
|
||||||
{
|
|
||||||
updateFilter(cutoff);
|
|
||||||
filterApplication.Validate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getInitialCutoff(BQFType type)
|
private int getInitialCutoff(BQFType type)
|
||||||
@ -93,13 +80,13 @@ namespace osu.Game.Audio.Effects
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFilter(int newValue)
|
private void updateFilter()
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case BQFType.LowPass:
|
case BQFType.LowPass:
|
||||||
// Workaround for weird behaviour when rapidly setting fCenter of a low-pass filter to nyquist - 1hz.
|
// Workaround for weird behaviour when rapidly setting fCenter of a low-pass filter to nyquist - 1hz.
|
||||||
if (newValue >= MAX_LOWPASS_CUTOFF)
|
if (Cutoff >= MAX_LOWPASS_CUTOFF)
|
||||||
{
|
{
|
||||||
ensureDetached();
|
ensureDetached();
|
||||||
return;
|
return;
|
||||||
@ -109,7 +96,7 @@ namespace osu.Game.Audio.Effects
|
|||||||
|
|
||||||
// Workaround for weird behaviour when rapidly setting fCenter of a high-pass filter to 1hz.
|
// Workaround for weird behaviour when rapidly setting fCenter of a high-pass filter to 1hz.
|
||||||
case BQFType.HighPass:
|
case BQFType.HighPass:
|
||||||
if (newValue <= 1)
|
if (Cutoff <= 1)
|
||||||
{
|
{
|
||||||
ensureDetached();
|
ensureDetached();
|
||||||
return;
|
return;
|
||||||
@ -120,17 +107,8 @@ namespace osu.Game.Audio.Effects
|
|||||||
|
|
||||||
ensureAttached();
|
ensureAttached();
|
||||||
|
|
||||||
int filterIndex = mixer.Effects.IndexOf(filter);
|
filter.fCenter = Cutoff;
|
||||||
|
mixer.UpdateEffect(filter);
|
||||||
if (filterIndex < 0) return;
|
|
||||||
|
|
||||||
if (mixer.Effects[filterIndex] is BQFParameters existingFilter)
|
|
||||||
{
|
|
||||||
existingFilter.fCenter = newValue;
|
|
||||||
|
|
||||||
// required to update effect with new parameters.
|
|
||||||
mixer.Effects[filterIndex] = existingFilter;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureAttached()
|
private void ensureAttached()
|
||||||
@ -138,8 +116,7 @@ namespace osu.Game.Audio.Effects
|
|||||||
if (IsAttached)
|
if (IsAttached)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Debug.Assert(!mixer.Effects.Contains(filter));
|
mixer.AddEffect(filter);
|
||||||
mixer.Effects.Add(filter);
|
|
||||||
IsAttached = true;
|
IsAttached = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,8 +125,7 @@ namespace osu.Game.Audio.Effects
|
|||||||
if (!IsAttached)
|
if (!IsAttached)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Debug.Assert(mixer.Effects.Contains(filter));
|
mixer.RemoveEffect(filter);
|
||||||
mixer.Effects.Remove(filter);
|
|
||||||
IsAttached = false;
|
IsAttached = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.IO.Serialization.Converters;
|
using osu.Game.IO.Serialization.Converters;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
@ -61,7 +62,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public ControlPointInfo ControlPointInfo { get; set; } = new ControlPointInfo();
|
public ControlPointInfo ControlPointInfo { get; set; } = new ControlPointInfo();
|
||||||
|
|
||||||
public List<BreakPeriod> Breaks { get; set; } = new List<BreakPeriod>();
|
public BindableList<BreakPeriod> Breaks { get; set; } = new BindableList<BreakPeriod>();
|
||||||
|
|
||||||
public List<string> UnhandledEventLines { get; set; } = new List<string>();
|
public List<string> UnhandledEventLines { get; set; } = new List<string>();
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
@ -9,10 +10,31 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Beatmaps.ControlPoints
|
namespace osu.Game.Beatmaps.ControlPoints
|
||||||
{
|
{
|
||||||
|
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
|
||||||
public abstract class ControlPoint : IComparable<ControlPoint>, IDeepCloneable<ControlPoint>, IEquatable<ControlPoint>, IControlPoint
|
public abstract class ControlPoint : IComparable<ControlPoint>, IDeepCloneable<ControlPoint>, IEquatable<ControlPoint>, IControlPoint
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when any of this <see cref="ControlPoint"/>'s properties have changed.
|
||||||
|
/// </summary>
|
||||||
|
public event Action<ControlPoint>? Changed;
|
||||||
|
|
||||||
|
protected void RaiseChanged() => Changed?.Invoke(this);
|
||||||
|
|
||||||
|
private double time;
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public double Time { get; set; }
|
public double Time
|
||||||
|
{
|
||||||
|
get => time;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (time == value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
time = value;
|
||||||
|
RaiseChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void AttachGroup(ControlPointGroup pointGroup) => Time = pointGroup.Time;
|
public void AttachGroup(ControlPointGroup pointGroup) => Time = pointGroup.Time;
|
||||||
|
|
||||||
|
@ -10,8 +10,11 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
public class ControlPointGroup : IComparable<ControlPointGroup>, IEquatable<ControlPointGroup>
|
public class ControlPointGroup : IComparable<ControlPointGroup>, IEquatable<ControlPointGroup>
|
||||||
{
|
{
|
||||||
public event Action<ControlPoint>? ItemAdded;
|
public event Action<ControlPoint>? ItemAdded;
|
||||||
|
public event Action<ControlPoint>? ItemChanged;
|
||||||
public event Action<ControlPoint>? ItemRemoved;
|
public event Action<ControlPoint>? ItemRemoved;
|
||||||
|
|
||||||
|
private void raiseItemChanged(ControlPoint controlPoint) => ItemChanged?.Invoke(controlPoint);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The time at which the control point takes effect.
|
/// The time at which the control point takes effect.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -39,12 +42,14 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
|
|
||||||
controlPoints.Add(point);
|
controlPoints.Add(point);
|
||||||
ItemAdded?.Invoke(point);
|
ItemAdded?.Invoke(point);
|
||||||
|
point.Changed += raiseItemChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Remove(ControlPoint point)
|
public void Remove(ControlPoint point)
|
||||||
{
|
{
|
||||||
controlPoints.Remove(point);
|
controlPoints.Remove(point);
|
||||||
ItemRemoved?.Invoke(point);
|
ItemRemoved?.Invoke(point);
|
||||||
|
point.Changed -= raiseItemChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override bool Equals(object? obj)
|
public sealed override bool Equals(object? obj)
|
||||||
|
@ -17,8 +17,17 @@ using osu.Game.Utils;
|
|||||||
namespace osu.Game.Beatmaps.ControlPoints
|
namespace osu.Game.Beatmaps.ControlPoints
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
|
||||||
public class ControlPointInfo : IDeepCloneable<ControlPointInfo>
|
public class ControlPointInfo : IDeepCloneable<ControlPointInfo>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked on any change to the set of control points.
|
||||||
|
/// </summary>
|
||||||
|
[CanBeNull]
|
||||||
|
public event Action ControlPointsChanged;
|
||||||
|
|
||||||
|
private void raiseControlPointsChanged([CanBeNull] ControlPoint _ = null) => ControlPointsChanged?.Invoke();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All control points grouped by time.
|
/// All control points grouped by time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -116,6 +125,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
if (addIfNotExisting)
|
if (addIfNotExisting)
|
||||||
{
|
{
|
||||||
newGroup.ItemAdded += GroupItemAdded;
|
newGroup.ItemAdded += GroupItemAdded;
|
||||||
|
newGroup.ItemChanged += raiseControlPointsChanged;
|
||||||
newGroup.ItemRemoved += GroupItemRemoved;
|
newGroup.ItemRemoved += GroupItemRemoved;
|
||||||
|
|
||||||
groups.Insert(~i, newGroup);
|
groups.Insert(~i, newGroup);
|
||||||
@ -131,6 +141,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
group.Remove(item);
|
group.Remove(item);
|
||||||
|
|
||||||
group.ItemAdded -= GroupItemAdded;
|
group.ItemAdded -= GroupItemAdded;
|
||||||
|
group.ItemChanged -= raiseControlPointsChanged;
|
||||||
group.ItemRemoved -= GroupItemRemoved;
|
group.ItemRemoved -= GroupItemRemoved;
|
||||||
|
|
||||||
groups.Remove(group);
|
groups.Remove(group);
|
||||||
@ -287,6 +298,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
default:
|
default:
|
||||||
throw new ArgumentException($"A control point of unexpected type {controlPoint.GetType()} was added to this {nameof(ControlPointInfo)}");
|
throw new ArgumentException($"A control point of unexpected type {controlPoint.GetType()} was added to this {nameof(ControlPointInfo)}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
raiseControlPointsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void GroupItemRemoved(ControlPoint controlPoint)
|
protected virtual void GroupItemRemoved(ControlPoint controlPoint)
|
||||||
@ -301,6 +314,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
effectPoints.Remove(typed);
|
effectPoints.Remove(typed);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
raiseControlPointsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlPointInfo DeepClone()
|
public ControlPointInfo DeepClone()
|
||||||
|
@ -44,6 +44,11 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
set => SliderVelocityBindable.Value = value;
|
set => SliderVelocityBindable.Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DifficultyControlPoint()
|
||||||
|
{
|
||||||
|
SliderVelocityBindable.BindValueChanged(_ => RaiseChanged());
|
||||||
|
}
|
||||||
|
|
||||||
public override bool IsRedundant(ControlPoint? existing)
|
public override bool IsRedundant(ControlPoint? existing)
|
||||||
=> existing is DifficultyControlPoint existingDifficulty
|
=> existing is DifficultyControlPoint existingDifficulty
|
||||||
&& GenerateTicks == existingDifficulty.GenerateTicks
|
&& GenerateTicks == existingDifficulty.GenerateTicks
|
||||||
|
@ -50,6 +50,12 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
set => KiaiModeBindable.Value = value;
|
set => KiaiModeBindable.Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EffectControlPoint()
|
||||||
|
{
|
||||||
|
KiaiModeBindable.BindValueChanged(_ => RaiseChanged());
|
||||||
|
ScrollSpeedBindable.BindValueChanged(_ => RaiseChanged());
|
||||||
|
}
|
||||||
|
|
||||||
public override bool IsRedundant(ControlPoint? existing)
|
public override bool IsRedundant(ControlPoint? existing)
|
||||||
=> existing is EffectControlPoint existingEffect
|
=> existing is EffectControlPoint existingEffect
|
||||||
&& KiaiMode == existingEffect.KiaiMode
|
&& KiaiMode == existingEffect.KiaiMode
|
||||||
|
@ -56,6 +56,12 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
set => SampleVolumeBindable.Value = value;
|
set => SampleVolumeBindable.Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SampleControlPoint()
|
||||||
|
{
|
||||||
|
SampleBankBindable.BindValueChanged(_ => RaiseChanged());
|
||||||
|
SampleVolumeBindable.BindValueChanged(_ => RaiseChanged());
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a SampleInfo based on the sample settings in this control point.
|
/// Create a SampleInfo based on the sample settings in this control point.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -82,6 +82,13 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double BPM => 60000 / BeatLength;
|
public double BPM => 60000 / BeatLength;
|
||||||
|
|
||||||
|
public TimingControlPoint()
|
||||||
|
{
|
||||||
|
TimeSignatureBindable.BindValueChanged(_ => RaiseChanged());
|
||||||
|
OmitFirstBarLineBindable.BindValueChanged(_ => RaiseChanged());
|
||||||
|
BeatLengthBindable.BindValueChanged(_ => RaiseChanged());
|
||||||
|
}
|
||||||
|
|
||||||
// Timing points are never redundant as they can change the time signature.
|
// Timing points are never redundant as they can change the time signature.
|
||||||
public override bool IsRedundant(ControlPoint? existing) => false;
|
public override bool IsRedundant(ControlPoint? existing) => false;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Beatmaps.Timing;
|
using osu.Game.Beatmaps.Timing;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -40,7 +41,7 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The breaks in this beatmap.
|
/// The breaks in this beatmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
List<BreakPeriod> Breaks { get; }
|
BindableList<BreakPeriod> Breaks { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All lines from the [Events] section which aren't handled in the encoding process yet.
|
/// All lines from the [Events] section which aren't handled in the encoding process yet.
|
||||||
|
@ -1,26 +1,44 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Timing
|
namespace osu.Game.Beatmaps.Timing
|
||||||
{
|
{
|
||||||
public class BreakPeriod
|
public class BreakPeriod : IEquatable<BreakPeriod>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The minimum gap between the start of the break and the previous object.
|
||||||
|
/// </summary>
|
||||||
|
public const double GAP_BEFORE_BREAK = 200;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The minimum gap between the end of the break and the next object.
|
||||||
|
/// Based on osu! preempt time at AR=10.
|
||||||
|
/// See also: https://github.com/ppy/osu/issues/14330#issuecomment-1002158551
|
||||||
|
/// </summary>
|
||||||
|
public const double GAP_AFTER_BREAK = 450;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The minimum duration required for a break to have any effect.
|
/// The minimum duration required for a break to have any effect.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const double MIN_BREAK_DURATION = 650;
|
public const double MIN_BREAK_DURATION = 650;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The minimum required duration of a gap between two objects such that a break can be placed between them.
|
||||||
|
/// </summary>
|
||||||
|
public const double MIN_GAP_DURATION = GAP_BEFORE_BREAK + MIN_BREAK_DURATION + GAP_AFTER_BREAK;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The break start time.
|
/// The break start time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double StartTime;
|
public double StartTime { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The break end time.
|
/// The break end time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double EndTime;
|
public double EndTime { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The break duration.
|
/// The break duration.
|
||||||
@ -49,5 +67,14 @@ namespace osu.Game.Beatmaps.Timing
|
|||||||
/// <param name="time">The time to check in milliseconds.</param>
|
/// <param name="time">The time to check in milliseconds.</param>
|
||||||
/// <returns>Whether the time falls within this <see cref="BreakPeriod"/>.</returns>
|
/// <returns>Whether the time falls within this <see cref="BreakPeriod"/>.</returns>
|
||||||
public bool Contains(double time) => time >= StartTime && time <= EndTime - BreakOverlay.BREAK_FADE_DURATION;
|
public bool Contains(double time) => time >= StartTime && time <= EndTime - BreakOverlay.BREAK_FADE_DURATION;
|
||||||
|
|
||||||
|
public bool Intersects(BreakPeriod other) => StartTime <= other.EndTime && EndTime >= other.StartTime;
|
||||||
|
|
||||||
|
public virtual bool Equals(BreakPeriod? other) =>
|
||||||
|
other != null
|
||||||
|
&& StartTime == other.StartTime
|
||||||
|
&& EndTime == other.EndTime;
|
||||||
|
|
||||||
|
public override int GetHashCode() => HashCode.Combine(StartTime, EndTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,6 +208,9 @@ namespace osu.Game.Configuration
|
|||||||
|
|
||||||
SetDefault(OsuSetting.ComboColourNormalisationAmount, 0.2f, 0f, 1f, 0.01f);
|
SetDefault(OsuSetting.ComboColourNormalisationAmount, 0.2f, 0f, 1f, 0.01f);
|
||||||
SetDefault<UserStatus?>(OsuSetting.UserOnlineStatus, null);
|
SetDefault<UserStatus?>(OsuSetting.UserOnlineStatus, null);
|
||||||
|
|
||||||
|
SetDefault(OsuSetting.EditorTimelineShowTimingChanges, true);
|
||||||
|
SetDefault(OsuSetting.EditorTimelineShowTicks, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool CheckLookupContainsPrivateInformation(OsuSetting lookup)
|
protected override bool CheckLookupContainsPrivateInformation(OsuSetting lookup)
|
||||||
@ -439,5 +442,7 @@ namespace osu.Game.Configuration
|
|||||||
UserOnlineStatus,
|
UserOnlineStatus,
|
||||||
MultiplayerRoomFilter,
|
MultiplayerRoomFilter,
|
||||||
HideCountryFlags,
|
HideCountryFlags,
|
||||||
|
EditorTimelineShowTimingChanges,
|
||||||
|
EditorTimelineShowTicks,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
inputManager = GetContainingInputManager();
|
inputManager = GetContainingInputManager()!;
|
||||||
showDuringTouch = config.GetBindable<bool>(OsuSetting.GameplayCursorDuringTouch);
|
showDuringTouch = config.GetBindable<bool>(OsuSetting.GameplayCursorDuringTouch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
if (!allowImmediateFocus)
|
if (!allowImmediateFocus)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Scheduler.Add(() => GetContainingFocusManager().ChangeFocus(this));
|
Scheduler.Add(() => GetContainingFocusManager()!.ChangeFocus(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public new void KillFocus() => base.KillFocus();
|
public new void KillFocus() => base.KillFocus();
|
||||||
|
@ -59,7 +59,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
protected override void OnFocus(FocusEvent e)
|
protected override void OnFocus(FocusEvent e)
|
||||||
{
|
{
|
||||||
base.OnFocus(e);
|
base.OnFocus(e);
|
||||||
GetContainingFocusManager().ChangeFocus(Component);
|
GetContainingFocusManager()!.ChangeFocus(Component);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override OsuTextBox CreateComponent() => CreateTextBox().With(t =>
|
protected override OsuTextBox CreateComponent() => CreateTextBox().With(t =>
|
||||||
|
@ -85,7 +85,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
Current.BindValueChanged(updateTextBoxFromSlider, true);
|
Current.BindValueChanged(updateTextBoxFromSlider, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TakeFocus() => GetContainingFocusManager().ChangeFocus(textBox);
|
public bool TakeFocus() => GetContainingFocusManager()?.ChangeFocus(textBox) == true;
|
||||||
|
|
||||||
public bool SelectAll() => textBox.SelectAll();
|
public bool SelectAll() => textBox.SelectAll();
|
||||||
|
|
||||||
|
@ -99,16 +99,6 @@ namespace osu.Game.Localisation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString TestBeatmap => new TranslatableString(getKey(@"test_beatmap"), @"Test!");
|
public static LocalisableString TestBeatmap => new TranslatableString(getKey(@"test_beatmap"), @"Test!");
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// "Waveform"
|
|
||||||
/// </summary>
|
|
||||||
public static LocalisableString TimelineWaveform => new TranslatableString(getKey(@"timeline_waveform"), @"Waveform");
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// "Ticks"
|
|
||||||
/// </summary>
|
|
||||||
public static LocalisableString TimelineTicks => new TranslatableString(getKey(@"timeline_ticks"), @"Ticks");
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "{0:0}°"
|
/// "{0:0}°"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -134,6 +124,21 @@ namespace osu.Game.Localisation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString FailedToParseEditorLink => new TranslatableString(getKey(@"failed_to_parse_edtior_link"), @"Failed to parse editor link");
|
public static LocalisableString FailedToParseEditorLink => new TranslatableString(getKey(@"failed_to_parse_edtior_link"), @"Failed to parse editor link");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Timeline"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString Timeline => new TranslatableString(getKey(@"timeline"), @"Timeline");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Show timing changes"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString TimelineShowTimingChanges => new TranslatableString(getKey(@"timeline_show_timing_changes"), @"Show timing changes");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Show ticks"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString TimelineShowTicks => new TranslatableString(getKey(@"timeline_show_ticks"), @"Show ticks");
|
||||||
|
|
||||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ namespace osu.Game.Overlays.AccountCreation
|
|||||||
|
|
||||||
if (nextTextBox != null)
|
if (nextTextBox != null)
|
||||||
{
|
{
|
||||||
Schedule(() => GetContainingFocusManager().ChangeFocus(nextTextBox));
|
Schedule(() => GetContainingFocusManager()!.ChangeFocus(nextTextBox));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Comments
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
if (!TextBox.ReadOnly)
|
if (!TextBox.ReadOnly)
|
||||||
GetContainingFocusManager().ChangeFocus(TextBox);
|
GetContainingFocusManager()!.ChangeFocus(TextBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnCommit(string text)
|
protected override void OnCommit(string text)
|
||||||
|
@ -150,7 +150,7 @@ namespace osu.Game.Overlays.Login
|
|||||||
|
|
||||||
protected override void OnFocus(FocusEvent e)
|
protected override void OnFocus(FocusEvent e)
|
||||||
{
|
{
|
||||||
Schedule(() => { GetContainingFocusManager().ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); });
|
Schedule(() => { GetContainingFocusManager()!.ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ namespace osu.Game.Overlays.Login
|
|||||||
|
|
||||||
protected override void OnFocus(FocusEvent e)
|
protected override void OnFocus(FocusEvent e)
|
||||||
{
|
{
|
||||||
if (form != null) GetContainingFocusManager().ChangeFocus(form);
|
if (form != null) GetContainingFocusManager()!.ChangeFocus(form);
|
||||||
base.OnFocus(e);
|
base.OnFocus(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ namespace osu.Game.Overlays.Login
|
|||||||
|
|
||||||
protected override void OnFocus(FocusEvent e)
|
protected override void OnFocus(FocusEvent e)
|
||||||
{
|
{
|
||||||
Schedule(() => { GetContainingFocusManager().ChangeFocus(codeTextBox); });
|
Schedule(() => { GetContainingFocusManager()!.ChangeFocus(codeTextBox); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ namespace osu.Game.Overlays
|
|||||||
this.FadeIn(transition_time, Easing.OutQuint);
|
this.FadeIn(transition_time, Easing.OutQuint);
|
||||||
FadeEdgeEffectTo(WaveContainer.SHADOW_OPACITY, WaveContainer.APPEAR_DURATION, Easing.Out);
|
FadeEdgeEffectTo(WaveContainer.SHADOW_OPACITY, WaveContainer.APPEAR_DURATION, Easing.Out);
|
||||||
|
|
||||||
ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(panel));
|
ScheduleAfterChildren(() => GetContainingFocusManager()!.ChangeFocus(panel));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
|
@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(nameTextBox));
|
ScheduleAfterChildren(() => GetContainingFocusManager()!.ChangeFocus(nameTextBox));
|
||||||
|
|
||||||
nameTextBox.Current.BindValueChanged(s =>
|
nameTextBox.Current.BindValueChanged(s =>
|
||||||
{
|
{
|
||||||
|
@ -136,7 +136,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(nameTextBox));
|
ScheduleAfterChildren(() => GetContainingFocusManager()!.ChangeFocus(nameTextBox));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||||
|
@ -949,7 +949,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
RequestScroll?.Invoke(this);
|
RequestScroll?.Invoke(this);
|
||||||
|
|
||||||
// Killing focus is done here because it's the only feasible place on ModSelectOverlay you can click on without triggering any action.
|
// Killing focus is done here because it's the only feasible place on ModSelectOverlay you can click on without triggering any action.
|
||||||
Scheduler.Add(() => GetContainingFocusManager().ChangeFocus(null));
|
Scheduler.Add(() => GetContainingFocusManager()!.ChangeFocus(null));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -465,7 +465,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (HasFocus)
|
if (HasFocus)
|
||||||
GetContainingFocusManager().ChangeFocus(null);
|
GetContainingFocusManager()!.ChangeFocus(null);
|
||||||
|
|
||||||
cancelAndClearButtons.FadeOut(300, Easing.OutQuint);
|
cancelAndClearButtons.FadeOut(300, Easing.OutQuint);
|
||||||
cancelAndClearButtons.BypassAutoSizeAxes |= Axes.Y;
|
cancelAndClearButtons.BypassAutoSizeAxes |= Axes.Y;
|
||||||
|
@ -106,7 +106,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
{
|
{
|
||||||
var next = Children.SkipWhile(c => c != sender).Skip(1).FirstOrDefault();
|
var next = Children.SkipWhile(c => c != sender).Skip(1).FirstOrDefault();
|
||||||
if (next != null)
|
if (next != null)
|
||||||
GetContainingFocusManager().ChangeFocus(next);
|
GetContainingFocusManager()?.ChangeFocus(next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
searchTextBox.HoldFocus = false;
|
searchTextBox.HoldFocus = false;
|
||||||
if (searchTextBox.HasFocus)
|
if (searchTextBox.HasFocus)
|
||||||
GetContainingFocusManager().ChangeFocus(null);
|
GetContainingFocusManager()!.ChangeFocus(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool AcceptsFocus => true;
|
public override bool AcceptsFocus => true;
|
||||||
|
@ -669,7 +669,7 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
{
|
{
|
||||||
SpriteName = { Value = file.Name },
|
SpriteName = { Value = file.Name },
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Position = skinnableTarget.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position),
|
Position = skinnableTarget.ToLocalSpace(GetContainingInputManager()!.CurrentState.Mouse.Position),
|
||||||
};
|
};
|
||||||
|
|
||||||
SelectedComponents.Clear();
|
SelectedComponents.Clear();
|
||||||
|
@ -9,6 +9,7 @@ using System.Linq;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
@ -329,7 +330,7 @@ namespace osu.Game.Rulesets.Difficulty
|
|||||||
set => baseBeatmap.Difficulty = value;
|
set => baseBeatmap.Difficulty = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BreakPeriod> Breaks => baseBeatmap.Breaks;
|
public BindableList<BreakPeriod> Breaks => baseBeatmap.Breaks;
|
||||||
public List<string> UnhandledEventLines => baseBeatmap.UnhandledEventLines;
|
public List<string> UnhandledEventLines => baseBeatmap.UnhandledEventLines;
|
||||||
|
|
||||||
public double TotalBreakTime => baseBeatmap.TotalBreakTime;
|
public double TotalBreakTime => baseBeatmap.TotalBreakTime;
|
||||||
|
@ -13,13 +13,7 @@ namespace osu.Game.Rulesets.Edit.Checks
|
|||||||
{
|
{
|
||||||
// Breaks may be off by 1 ms.
|
// Breaks may be off by 1 ms.
|
||||||
private const int leniency_threshold = 1;
|
private const int leniency_threshold = 1;
|
||||||
private const double minimum_gap_before_break = 200;
|
|
||||||
|
|
||||||
// Break end time depends on the upcoming object's pre-empt time.
|
|
||||||
// As things stand, "pre-empt time" is only defined for osu! standard
|
|
||||||
// This is a generic value representing AR=10
|
|
||||||
// Relevant: https://github.com/ppy/osu/issues/14330#issuecomment-1002158551
|
|
||||||
private const double min_end_threshold = 450;
|
|
||||||
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Events, "Breaks not achievable using the editor");
|
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Events, "Breaks not achievable using the editor");
|
||||||
|
|
||||||
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||||
@ -45,8 +39,8 @@ namespace osu.Game.Rulesets.Edit.Checks
|
|||||||
if (previousObjectEndTimeIndex >= 0)
|
if (previousObjectEndTimeIndex >= 0)
|
||||||
{
|
{
|
||||||
double gapBeforeBreak = breakPeriod.StartTime - endTimes[previousObjectEndTimeIndex];
|
double gapBeforeBreak = breakPeriod.StartTime - endTimes[previousObjectEndTimeIndex];
|
||||||
if (gapBeforeBreak < minimum_gap_before_break - leniency_threshold)
|
if (gapBeforeBreak < BreakPeriod.GAP_BEFORE_BREAK - leniency_threshold)
|
||||||
yield return new IssueTemplateEarlyStart(this).Create(breakPeriod.StartTime, minimum_gap_before_break - gapBeforeBreak);
|
yield return new IssueTemplateEarlyStart(this).Create(breakPeriod.StartTime, BreakPeriod.GAP_BEFORE_BREAK - gapBeforeBreak);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nextObjectStartTimeIndex = startTimes.BinarySearch(breakPeriod.EndTime);
|
int nextObjectStartTimeIndex = startTimes.BinarySearch(breakPeriod.EndTime);
|
||||||
@ -55,8 +49,8 @@ namespace osu.Game.Rulesets.Edit.Checks
|
|||||||
if (nextObjectStartTimeIndex < startTimes.Count)
|
if (nextObjectStartTimeIndex < startTimes.Count)
|
||||||
{
|
{
|
||||||
double gapAfterBreak = startTimes[nextObjectStartTimeIndex] - breakPeriod.EndTime;
|
double gapAfterBreak = startTimes[nextObjectStartTimeIndex] - breakPeriod.EndTime;
|
||||||
if (gapAfterBreak < min_end_threshold - leniency_threshold)
|
if (gapAfterBreak < BreakPeriod.GAP_AFTER_BREAK - leniency_threshold)
|
||||||
yield return new IssueTemplateLateEnd(this).Create(breakPeriod.StartTime, min_end_threshold - gapAfterBreak);
|
yield return new IssueTemplateLateEnd(this).Create(breakPeriod.StartTime, BreakPeriod.GAP_AFTER_BREAK - gapAfterBreak);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.EnumExtensions;
|
using osu.Framework.Extensions.EnumExtensions;
|
||||||
@ -79,14 +80,16 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
protected InputManager InputManager { get; private set; }
|
protected InputManager InputManager { get; private set; }
|
||||||
|
|
||||||
|
private Box leftToolboxBackground;
|
||||||
|
private Box rightToolboxBackground;
|
||||||
|
|
||||||
private EditorRadioButtonCollection toolboxCollection;
|
private EditorRadioButtonCollection toolboxCollection;
|
||||||
|
|
||||||
private FillFlowContainer togglesCollection;
|
private FillFlowContainer togglesCollection;
|
||||||
|
|
||||||
private FillFlowContainer sampleBankTogglesCollection;
|
private FillFlowContainer sampleBankTogglesCollection;
|
||||||
|
|
||||||
private IBindable<bool> hasTiming;
|
private IBindable<bool> hasTiming;
|
||||||
private Bindable<bool> autoSeekOnPlacement;
|
private Bindable<bool> autoSeekOnPlacement;
|
||||||
|
private readonly Bindable<bool> composerFocusMode = new Bindable<bool>();
|
||||||
|
|
||||||
protected DrawableRuleset<TObject> DrawableRuleset { get; private set; }
|
protected DrawableRuleset<TObject> DrawableRuleset { get; private set; }
|
||||||
|
|
||||||
@ -98,11 +101,14 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
||||||
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager config, [CanBeNull] Editor editor)
|
||||||
{
|
{
|
||||||
autoSeekOnPlacement = config.GetBindable<bool>(OsuSetting.EditorAutoSeekOnPlacement);
|
autoSeekOnPlacement = config.GetBindable<bool>(OsuSetting.EditorAutoSeekOnPlacement);
|
||||||
|
|
||||||
|
if (editor != null)
|
||||||
|
composerFocusMode.BindTo(editor.ComposerFocusMode);
|
||||||
|
|
||||||
Config = Dependencies.Get<IRulesetConfigCache>().GetConfigFor(Ruleset);
|
Config = Dependencies.Get<IRulesetConfigCache>().GetConfigFor(Ruleset);
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -127,7 +133,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
InternalChildren = new[]
|
InternalChildren = new[]
|
||||||
{
|
{
|
||||||
PlayfieldContentContainer = new Container
|
PlayfieldContentContainer = new ContentContainer
|
||||||
{
|
{
|
||||||
Name = "Playfield content",
|
Name = "Playfield content",
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
@ -147,7 +153,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
leftToolboxBackground = new Box
|
||||||
{
|
{
|
||||||
Colour = colourProvider.Background5,
|
Colour = colourProvider.Background5,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -192,7 +198,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
rightToolboxBackground = new Box
|
||||||
{
|
{
|
||||||
Colour = colourProvider.Background5,
|
Colour = colourProvider.Background5,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -261,6 +267,13 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
item.Selected.Disabled = !hasTiming.NewValue;
|
item.Selected.Disabled = !hasTiming.NewValue;
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
composerFocusMode.BindValueChanged(_ =>
|
||||||
|
{
|
||||||
|
float targetAlpha = composerFocusMode.Value ? 0.5f : 1;
|
||||||
|
leftToolboxBackground.FadeTo(targetAlpha, 400, Easing.OutQuint);
|
||||||
|
rightToolboxBackground.FadeTo(targetAlpha, 400, Easing.OutQuint);
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
@ -508,6 +521,31 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private partial class ContentContainer : Container
|
||||||
|
{
|
||||||
|
public override bool HandlePositionalInput => true;
|
||||||
|
|
||||||
|
private readonly Bindable<bool> composerFocusMode = new Bindable<bool>();
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(true)]
|
||||||
|
private void load([CanBeNull] Editor editor)
|
||||||
|
{
|
||||||
|
if (editor != null)
|
||||||
|
composerFocusMode.BindTo(editor.ComposerFocusMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
{
|
||||||
|
composerFocusMode.Value = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
|
{
|
||||||
|
composerFocusMode.Value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Extensions.ObjectExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
@ -12,6 +13,7 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
using osu.Game.Rulesets.Edit.Tools;
|
using osu.Game.Rulesets.Edit.Tools;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Components.TernaryButtons;
|
using osu.Game.Screens.Edit.Components.TernaryButtons;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -21,6 +23,9 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
public abstract partial class ScrollingHitObjectComposer<TObject> : HitObjectComposer<TObject>
|
public abstract partial class ScrollingHitObjectComposer<TObject> : HitObjectComposer<TObject>
|
||||||
where TObject : HitObject
|
where TObject : HitObject
|
||||||
{
|
{
|
||||||
|
[Resolved]
|
||||||
|
private Editor? editor { get; set; }
|
||||||
|
|
||||||
private readonly Bindable<TernaryState> showSpeedChanges = new Bindable<TernaryState>();
|
private readonly Bindable<TernaryState> showSpeedChanges = new Bindable<TernaryState>();
|
||||||
private Bindable<bool> configShowSpeedChanges = null!;
|
private Bindable<bool> configShowSpeedChanges = null!;
|
||||||
|
|
||||||
@ -72,6 +77,8 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
if (beatSnapGrid != null)
|
if (beatSnapGrid != null)
|
||||||
AddInternal(beatSnapGrid);
|
AddInternal(beatSnapGrid);
|
||||||
|
|
||||||
|
EditorBeatmap.ControlPointInfo.ControlPointsChanged += expireComposeScreenOnControlPointChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
@ -104,5 +111,15 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
beatSnapGrid.SelectionTimeRange = null;
|
beatSnapGrid.SelectionTimeRange = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
if (EditorBeatmap.IsNotNull())
|
||||||
|
EditorBeatmap.ControlPointInfo.ControlPointsChanged -= expireComposeScreenOnControlPointChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void expireComposeScreenOnControlPointChange() => editor?.ReloadComposeScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@ -21,6 +22,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The base class for gameplay modifiers.
|
/// The base class for gameplay modifiers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
|
||||||
public abstract class Mod : IMod, IEquatable<Mod>, IDeepCloneable<Mod>
|
public abstract class Mod : IMod, IEquatable<Mod>, IDeepCloneable<Mod>
|
||||||
{
|
{
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
@ -224,8 +224,16 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
/// <returns>A populated <see cref="HitSampleInfo"/>.</returns>
|
/// <returns>A populated <see cref="HitSampleInfo"/>.</returns>
|
||||||
public HitSampleInfo CreateHitSampleInfo(string sampleName = HitSampleInfo.HIT_NORMAL)
|
public HitSampleInfo CreateHitSampleInfo(string sampleName = HitSampleInfo.HIT_NORMAL)
|
||||||
{
|
{
|
||||||
if (Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL) is HitSampleInfo existingSample)
|
// As per stable, all non-normal "addition" samples should use the same bank.
|
||||||
return existingSample.With(newName: sampleName);
|
if (sampleName != HitSampleInfo.HIT_NORMAL)
|
||||||
|
{
|
||||||
|
if (Samples.FirstOrDefault(s => s.Name != HitSampleInfo.HIT_NORMAL) is HitSampleInfo existingAddition)
|
||||||
|
return existingAddition.With(newName: sampleName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fall back to using the normal sample bank otherwise.
|
||||||
|
if (Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL) is HitSampleInfo existingNormal)
|
||||||
|
return existingNormal.With(newName: sampleName);
|
||||||
|
|
||||||
return new HitSampleInfo(sampleName);
|
return new HitSampleInfo(sampleName);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Types
|
namespace osu.Game.Rulesets.Objects.Types
|
||||||
{
|
{
|
||||||
@ -45,5 +46,19 @@ namespace osu.Game.Rulesets.Objects.Types
|
|||||||
public static IList<HitSampleInfo> GetNodeSamples<T>(this T obj, int nodeIndex)
|
public static IList<HitSampleInfo> GetNodeSamples<T>(this T obj, int nodeIndex)
|
||||||
where T : HitObject, IHasRepeats
|
where T : HitObject, IHasRepeats
|
||||||
=> nodeIndex < obj.NodeSamples.Count ? obj.NodeSamples[nodeIndex] : obj.Samples;
|
=> nodeIndex < obj.NodeSamples.Count ? obj.NodeSamples[nodeIndex] : obj.Samples;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ensures that the list of node samples is at least as long as the number of nodes.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">The <see cref="HitObject"/>.</param>
|
||||||
|
public static void PopulateNodeSamples<T>(this T obj)
|
||||||
|
where T : HitObject, IHasRepeats
|
||||||
|
{
|
||||||
|
if (obj.NodeSamples.Count >= obj.RepeatCount + 2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
while (obj.NodeSamples.Count < obj.RepeatCount + 2)
|
||||||
|
obj.NodeSamples.Add(obj.Samples.Select(o => o.With()).ToList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Effects;
|
using osu.Framework.Graphics.Effects;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Overlays;
|
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Screens.Edit.Components;
|
using osu.Game.Screens.Edit.Components;
|
||||||
using osu.Game.Screens.Edit.Components.Timelines.Summary;
|
using osu.Game.Screens.Edit.Components.Timelines.Summary;
|
||||||
@ -21,12 +18,13 @@ namespace osu.Game.Screens.Edit
|
|||||||
{
|
{
|
||||||
internal partial class BottomBar : CompositeDrawable
|
internal partial class BottomBar : CompositeDrawable
|
||||||
{
|
{
|
||||||
public TestGameplayButton TestGameplayButton { get; private set; }
|
public TestGameplayButton TestGameplayButton { get; private set; } = null!;
|
||||||
|
|
||||||
private IBindable<bool> saveInProgress;
|
private IBindable<bool> saveInProgress = null!;
|
||||||
|
private Bindable<bool> composerFocusMode = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider, Editor editor)
|
private void load(Editor editor)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft;
|
Anchor = Anchor.BottomLeft;
|
||||||
Origin = Anchor.BottomLeft;
|
Origin = Anchor.BottomLeft;
|
||||||
@ -45,11 +43,6 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = colourProvider.Background4,
|
|
||||||
},
|
|
||||||
new GridContainer
|
new GridContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -79,6 +72,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
};
|
};
|
||||||
|
|
||||||
saveInProgress = editor.MutationTracker.InProgress.GetBoundCopy();
|
saveInProgress = editor.MutationTracker.InProgress.GetBoundCopy();
|
||||||
|
composerFocusMode = editor.ComposerFocusMode.GetBoundCopy();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -86,6 +80,13 @@ namespace osu.Game.Screens.Edit
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
saveInProgress.BindValueChanged(_ => TestGameplayButton.Enabled.Value = !saveInProgress.Value, true);
|
saveInProgress.BindValueChanged(_ => TestGameplayButton.Enabled.Value = !saveInProgress.Value, true);
|
||||||
|
composerFocusMode.BindValueChanged(_ =>
|
||||||
|
{
|
||||||
|
float targetAlpha = composerFocusMode.Value ? 0.5f : 1;
|
||||||
|
|
||||||
|
foreach (var c in this.ChildrenOfType<BottomBarContainer>())
|
||||||
|
c.Background.FadeTo(targetAlpha, 400, Easing.OutQuint);
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Screens.Edit.Components
|
|||||||
|
|
||||||
protected readonly IBindable<Track> Track = new Bindable<Track>();
|
protected readonly IBindable<Track> Track = new Bindable<Track>();
|
||||||
|
|
||||||
protected readonly Drawable Background;
|
public readonly Drawable Background;
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
@ -32,8 +32,10 @@ namespace osu.Game.Screens.Edit.Components
|
|||||||
private readonly BindableNumber<double> freqAdjust = new BindableDouble(1);
|
private readonly BindableNumber<double> freqAdjust = new BindableDouble(1);
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
|
Background.Colour = colourProvider.Background4;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
playButton = new IconButton
|
playButton = new IconButton
|
||||||
|
@ -2,9 +2,11 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Beatmaps.Timing;
|
using osu.Game.Beatmaps.Timing;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
||||||
{
|
{
|
||||||
@ -13,22 +15,33 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class BreakPart : TimelinePart
|
public partial class BreakPart : TimelinePart
|
||||||
{
|
{
|
||||||
|
private readonly BindableList<BreakPeriod> breaks = new BindableList<BreakPeriod>();
|
||||||
|
|
||||||
protected override void LoadBeatmap(EditorBeatmap beatmap)
|
protected override void LoadBeatmap(EditorBeatmap beatmap)
|
||||||
{
|
{
|
||||||
base.LoadBeatmap(beatmap);
|
base.LoadBeatmap(beatmap);
|
||||||
foreach (var breakPeriod in beatmap.Breaks)
|
|
||||||
Add(new BreakVisualisation(breakPeriod));
|
breaks.UnbindAll();
|
||||||
|
breaks.BindTo(beatmap.Breaks);
|
||||||
|
breaks.BindCollectionChanged((_, _) =>
|
||||||
|
{
|
||||||
|
foreach (var breakPeriod in beatmap.Breaks)
|
||||||
|
Add(new BreakVisualisation(breakPeriod));
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private partial class BreakVisualisation : DurationVisualisation
|
private partial class BreakVisualisation : Circle
|
||||||
{
|
{
|
||||||
public BreakVisualisation(BreakPeriod breakPeriod)
|
public BreakVisualisation(BreakPeriod breakPeriod)
|
||||||
: base(breakPeriod.StartTime, breakPeriod.EndTime)
|
|
||||||
{
|
{
|
||||||
|
RelativePositionAxes = Axes.X;
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
X = (float)breakPeriod.StartTime;
|
||||||
|
Width = (float)breakPeriod.Duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours) => Colour = colours.GreyCarmineLight;
|
private void load(OsuColour colours) => Colour = colours.Gray7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
// 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 osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a spanning point on a timeline part.
|
|
||||||
/// </summary>
|
|
||||||
public partial class DurationVisualisation : Circle
|
|
||||||
{
|
|
||||||
protected DurationVisualisation(double startTime, double endTime)
|
|
||||||
{
|
|
||||||
RelativePositionAxes = Axes.X;
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
|
|
||||||
X = (float)startTime;
|
|
||||||
Width = (float)(endTime - startTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -580,7 +580,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
GetContainingFocusManager().ChangeFocus(this);
|
GetContainingFocusManager()!.ChangeFocus(this);
|
||||||
SelectAll();
|
SelectAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
yield return new TernaryButton(NewCombo, "New combo", () => new SpriteIcon { Icon = OsuIcon.EditorNewComboA });
|
yield return new TernaryButton(NewCombo, "New combo", () => new SpriteIcon { Icon = OsuIcon.EditorNewComboA });
|
||||||
|
|
||||||
foreach (var kvp in SelectionHandler.SelectionSampleStates)
|
foreach (var kvp in SelectionHandler.SelectionSampleStates)
|
||||||
yield return new TernaryButton(kvp.Value, kvp.Key.Replace("hit", string.Empty).Titleize(), () => getIconForSample(kvp.Key));
|
yield return new TernaryButton(kvp.Value, kvp.Key.Replace("hit", string.Empty).Titleize(), () => GetIconForSample(kvp.Key));
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<TernaryButton> createSampleBankTernaryButtons()
|
private IEnumerable<TernaryButton> createSampleBankTernaryButtons()
|
||||||
@ -264,7 +264,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getIconForSample(string sampleName)
|
public static Drawable GetIconForSample(string sampleName)
|
||||||
{
|
{
|
||||||
switch (sampleName)
|
switch (sampleName)
|
||||||
{
|
{
|
||||||
|
@ -227,6 +227,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
h.Samples.Add(h.CreateHitSampleInfo(sampleName));
|
h.Samples.Add(h.CreateHitSampleInfo(sampleName));
|
||||||
|
|
||||||
EditorBeatmap.Update(h);
|
EditorBeatmap.Update(h);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Given a selection target and a function of truth, retrieve the correct ternary state for display.
|
/// Given a selection target and a function of truth, retrieve the correct ternary state for display.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected static TernaryState GetStateFromSelection<TObject>(IEnumerable<TObject> selection, Func<TObject, bool> func)
|
public static TernaryState GetStateFromSelection<TObject>(IEnumerable<TObject> selection, Func<TObject, bool> func)
|
||||||
{
|
{
|
||||||
if (selection.Any(func))
|
if (selection.Any(func))
|
||||||
return selection.All(func) ? TernaryState.True : TernaryState.Indeterminate;
|
return selection.All(func) ? TernaryState.True : TernaryState.Indeterminate;
|
||||||
|
@ -138,7 +138,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(sliderVelocitySlider));
|
ScheduleAfterChildren(() => GetContainingFocusManager()!.ChangeFocus(sliderVelocitySlider));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
// 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;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Game.Audio;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||||
|
{
|
||||||
|
public partial class NodeSamplePointPiece : SamplePointPiece
|
||||||
|
{
|
||||||
|
public readonly int NodeIndex;
|
||||||
|
|
||||||
|
public NodeSamplePointPiece(HitObject hitObject, int nodeIndex)
|
||||||
|
: base(hitObject)
|
||||||
|
{
|
||||||
|
if (hitObject is not IHasRepeats)
|
||||||
|
throw new System.ArgumentException($"HitObject must implement {nameof(IHasRepeats)}", nameof(hitObject));
|
||||||
|
|
||||||
|
NodeIndex = nodeIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override IList<HitSampleInfo> GetSamples()
|
||||||
|
{
|
||||||
|
var hasRepeats = (IHasRepeats)HitObject;
|
||||||
|
return NodeIndex < hasRepeats.NodeSamples.Count ? hasRepeats.NodeSamples[NodeIndex] : HitObject.Samples;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Popover GetPopover() => new NodeSampleEditPopover(HitObject, NodeIndex);
|
||||||
|
|
||||||
|
public partial class NodeSampleEditPopover : SampleEditPopover
|
||||||
|
{
|
||||||
|
private readonly int nodeIndex;
|
||||||
|
|
||||||
|
protected override IList<HitSampleInfo> GetRelevantSamples(HitObject ho)
|
||||||
|
{
|
||||||
|
if (ho is not IHasRepeats hasRepeats)
|
||||||
|
return ho.Samples;
|
||||||
|
|
||||||
|
return nodeIndex < hasRepeats.NodeSamples.Count ? hasRepeats.NodeSamples[nodeIndex] : ho.Samples;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NodeSampleEditPopover(HitObject hitObject, int nodeIndex)
|
||||||
|
: base(hitObject)
|
||||||
|
{
|
||||||
|
this.nodeIndex = nodeIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,10 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Humanizer;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
@ -14,12 +16,15 @@ using osu.Framework.Graphics.UserInterface;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics.UserInterfaceV2;
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Screens.Edit.Components.TernaryButtons;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Screens.Edit.Timing;
|
using osu.Game.Screens.Edit.Timing;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||||
{
|
{
|
||||||
@ -27,20 +32,20 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
{
|
{
|
||||||
public readonly HitObject HitObject;
|
public readonly HitObject HitObject;
|
||||||
|
|
||||||
private readonly BindableList<HitSampleInfo> samplesBindable;
|
|
||||||
|
|
||||||
public SamplePointPiece(HitObject hitObject)
|
public SamplePointPiece(HitObject hitObject)
|
||||||
{
|
{
|
||||||
HitObject = hitObject;
|
HitObject = hitObject;
|
||||||
samplesBindable = hitObject.SamplesBindable.GetBoundCopy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Color4 GetRepresentingColour(OsuColour colours) => colours.Pink;
|
public bool AlternativeColor { get; init; }
|
||||||
|
|
||||||
|
protected override Color4 GetRepresentingColour(OsuColour colours) => AlternativeColor ? colours.Pink2 : colours.Pink1;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
samplesBindable.BindCollectionChanged((_, _) => updateText(), true);
|
HitObject.DefaultsApplied += _ => updateText();
|
||||||
|
updateText();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
@ -51,12 +56,28 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
private void updateText()
|
private void updateText()
|
||||||
{
|
{
|
||||||
Label.Text = $"{GetBankValue(samplesBindable)} {GetVolumeValue(samplesBindable)}";
|
Label.Text = $"{abbreviateBank(GetBankValue(GetSamples()))} {GetVolumeValue(GetSamples())}";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string? abbreviateBank(string? bank)
|
||||||
|
{
|
||||||
|
return bank switch
|
||||||
|
{
|
||||||
|
HitSampleInfo.BANK_NORMAL => @"N",
|
||||||
|
HitSampleInfo.BANK_SOFT => @"S",
|
||||||
|
HitSampleInfo.BANK_DRUM => @"D",
|
||||||
|
_ => bank
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string? GetBankValue(IEnumerable<HitSampleInfo> samples)
|
public static string? GetBankValue(IEnumerable<HitSampleInfo> samples)
|
||||||
{
|
{
|
||||||
return samples.FirstOrDefault()?.Bank;
|
return samples.FirstOrDefault(o => o.Name == HitSampleInfo.HIT_NORMAL)?.Bank;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string? GetAdditionBankValue(IEnumerable<HitSampleInfo> samples)
|
||||||
|
{
|
||||||
|
return samples.FirstOrDefault(o => o.Name != HitSampleInfo.HIT_NORMAL)?.Bank;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetVolumeValue(ICollection<HitSampleInfo> samples)
|
public static int GetVolumeValue(ICollection<HitSampleInfo> samples)
|
||||||
@ -64,15 +85,36 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
return samples.Count == 0 ? 0 : samples.Max(o => o.Volume);
|
return samples.Count == 0 ? 0 : samples.Max(o => o.Volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Popover GetPopover() => new SampleEditPopover(HitObject);
|
/// <summary>
|
||||||
|
/// Gets the samples to be edited by this sample point piece.
|
||||||
|
/// This could be the samples of the hit object itself, or of one of the nested hit objects. For example a slider repeat.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The samples to be edited.</returns>
|
||||||
|
protected virtual IList<HitSampleInfo> GetSamples() => HitObject.Samples;
|
||||||
|
|
||||||
|
public virtual Popover GetPopover() => new SampleEditPopover(HitObject);
|
||||||
|
|
||||||
public partial class SampleEditPopover : OsuPopover
|
public partial class SampleEditPopover : OsuPopover
|
||||||
{
|
{
|
||||||
private readonly HitObject hitObject;
|
private readonly HitObject hitObject;
|
||||||
|
|
||||||
private LabelledTextBox bank = null!;
|
private LabelledTextBox bank = null!;
|
||||||
|
private LabelledTextBox additionBank = null!;
|
||||||
private IndeterminateSliderWithTextBoxInput<int> volume = null!;
|
private IndeterminateSliderWithTextBoxInput<int> volume = null!;
|
||||||
|
|
||||||
|
private FillFlowContainer togglesCollection = null!;
|
||||||
|
|
||||||
|
private HitObject[] relevantObjects = null!;
|
||||||
|
private IList<HitSampleInfo>[] allRelevantSamples = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the sub-set of samples relevant to this sample point piece.
|
||||||
|
/// For example, to edit node samples this should return the samples at the index of the node.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ho">The hit object to get the relevant samples from.</param>
|
||||||
|
/// <returns>The relevant list of samples.</returns>
|
||||||
|
protected virtual IList<HitSampleInfo> GetRelevantSamples(HitObject ho) => ho.Samples;
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
private EditorBeatmap beatmap { get; set; } = null!;
|
private EditorBeatmap beatmap { get; set; } = null!;
|
||||||
|
|
||||||
@ -96,10 +138,21 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
Spacing = new Vector2(0, 10),
|
Spacing = new Vector2(0, 10),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
togglesCollection = new FillFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(5, 5),
|
||||||
|
},
|
||||||
bank = new LabelledTextBox
|
bank = new LabelledTextBox
|
||||||
{
|
{
|
||||||
Label = "Bank Name",
|
Label = "Bank Name",
|
||||||
},
|
},
|
||||||
|
additionBank = new LabelledTextBox
|
||||||
|
{
|
||||||
|
Label = "Addition Bank",
|
||||||
|
},
|
||||||
volume = new IndeterminateSliderWithTextBoxInput<int>("Volume", new BindableInt(100)
|
volume = new IndeterminateSliderWithTextBoxInput<int>("Volume", new BindableInt(100)
|
||||||
{
|
{
|
||||||
MinValue = DrawableHitObject.MINIMUM_SAMPLE_VOLUME,
|
MinValue = DrawableHitObject.MINIMUM_SAMPLE_VOLUME,
|
||||||
@ -110,89 +163,273 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
};
|
};
|
||||||
|
|
||||||
bank.TabbableContentContainer = flow;
|
bank.TabbableContentContainer = flow;
|
||||||
|
additionBank.TabbableContentContainer = flow;
|
||||||
volume.TabbableContentContainer = flow;
|
volume.TabbableContentContainer = flow;
|
||||||
|
|
||||||
// if the piece belongs to a currently selected object, assume that the user wants to change all selected objects.
|
// if the piece belongs to a currently selected object, assume that the user wants to change all selected objects.
|
||||||
// if the piece belongs to an unselected object, operate on that object alone, independently of the selection.
|
// if the piece belongs to an unselected object, operate on that object alone, independently of the selection.
|
||||||
var relevantObjects = (beatmap.SelectedHitObjects.Contains(hitObject) ? beatmap.SelectedHitObjects : hitObject.Yield()).ToArray();
|
relevantObjects = (beatmap.SelectedHitObjects.Contains(hitObject) ? beatmap.SelectedHitObjects : hitObject.Yield()).ToArray();
|
||||||
var relevantSamples = relevantObjects.Select(h => h.Samples).ToArray();
|
allRelevantSamples = relevantObjects.Select(GetRelevantSamples).ToArray();
|
||||||
|
|
||||||
// even if there are multiple objects selected, we can still display sample volume or bank if they all have the same value.
|
// even if there are multiple objects selected, we can still display sample volume or bank if they all have the same value.
|
||||||
string? commonBank = getCommonBank(relevantSamples);
|
int? commonVolume = getCommonVolume();
|
||||||
if (!string.IsNullOrEmpty(commonBank))
|
|
||||||
bank.Current.Value = commonBank;
|
|
||||||
|
|
||||||
int? commonVolume = getCommonVolume(relevantSamples);
|
|
||||||
if (commonVolume != null)
|
if (commonVolume != null)
|
||||||
volume.Current.Value = commonVolume.Value;
|
volume.Current.Value = commonVolume.Value;
|
||||||
|
|
||||||
updateBankPlaceholderText(relevantObjects);
|
updatePrimaryBankState();
|
||||||
bank.Current.BindValueChanged(val =>
|
bank.Current.BindValueChanged(val =>
|
||||||
{
|
{
|
||||||
updateBankFor(relevantObjects, val.NewValue);
|
if (string.IsNullOrEmpty(val.NewValue))
|
||||||
updateBankPlaceholderText(relevantObjects);
|
return;
|
||||||
|
|
||||||
|
setBank(val.NewValue);
|
||||||
|
updatePrimaryBankState();
|
||||||
});
|
});
|
||||||
// on commit, ensure that the value is correct by sourcing it from the objects' samples again.
|
// on commit, ensure that the value is correct by sourcing it from the objects' samples again.
|
||||||
// this ensures that committing empty text causes a revert to the previous value.
|
// this ensures that committing empty text causes a revert to the previous value.
|
||||||
bank.OnCommit += (_, _) => bank.Current.Value = getCommonBank(relevantSamples);
|
bank.OnCommit += (_, _) => updatePrimaryBankState();
|
||||||
|
|
||||||
volume.Current.BindValueChanged(val => updateVolumeFor(relevantObjects, val.NewValue));
|
updateAdditionBankState();
|
||||||
}
|
additionBank.Current.BindValueChanged(val =>
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(volume));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string? getCommonBank(IList<HitSampleInfo>[] relevantSamples) => relevantSamples.Select(GetBankValue).Distinct().Count() == 1 ? GetBankValue(relevantSamples.First()) : null;
|
|
||||||
private static int? getCommonVolume(IList<HitSampleInfo>[] relevantSamples) => relevantSamples.Select(GetVolumeValue).Distinct().Count() == 1 ? GetVolumeValue(relevantSamples.First()) : null;
|
|
||||||
|
|
||||||
private void updateBankFor(IEnumerable<HitObject> objects, string? newBank)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(newBank))
|
|
||||||
return;
|
|
||||||
|
|
||||||
beatmap.BeginChange();
|
|
||||||
|
|
||||||
foreach (var h in objects)
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < h.Samples.Count; i++)
|
if (string.IsNullOrEmpty(val.NewValue))
|
||||||
{
|
return;
|
||||||
h.Samples[i] = h.Samples[i].With(newBank: newBank);
|
|
||||||
}
|
|
||||||
|
|
||||||
beatmap.Update(h);
|
setAdditionBank(val.NewValue);
|
||||||
}
|
updateAdditionBankState();
|
||||||
|
});
|
||||||
|
additionBank.OnCommit += (_, _) => updateAdditionBankState();
|
||||||
|
|
||||||
beatmap.EndChange();
|
volume.Current.BindValueChanged(val =>
|
||||||
|
{
|
||||||
|
if (val.NewValue != null)
|
||||||
|
setVolume(val.NewValue.Value);
|
||||||
|
});
|
||||||
|
|
||||||
|
createStateBindables();
|
||||||
|
updateTernaryStates();
|
||||||
|
togglesCollection.AddRange(createTernaryButtons().Select(b => new DrawableTernaryButton(b) { RelativeSizeAxes = Axes.None, Size = new Vector2(40, 40) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBankPlaceholderText(IEnumerable<HitObject> objects)
|
private string? getCommonBank() => allRelevantSamples.Select(GetBankValue).Distinct().Count() == 1 ? GetBankValue(allRelevantSamples.First()) : null;
|
||||||
|
private string? getCommonAdditionBank() => allRelevantSamples.Select(GetAdditionBankValue).Where(o => o is not null).Distinct().Count() == 1 ? GetAdditionBankValue(allRelevantSamples.First()) : null;
|
||||||
|
private int? getCommonVolume() => allRelevantSamples.Select(GetVolumeValue).Distinct().Count() == 1 ? GetVolumeValue(allRelevantSamples.First()) : null;
|
||||||
|
|
||||||
|
private void updatePrimaryBankState()
|
||||||
{
|
{
|
||||||
string? commonBank = getCommonBank(objects.Select(h => h.Samples).ToArray());
|
string? commonBank = getCommonBank();
|
||||||
|
bank.Current.Value = commonBank;
|
||||||
bank.PlaceholderText = string.IsNullOrEmpty(commonBank) ? "(multiple)" : string.Empty;
|
bank.PlaceholderText = string.IsNullOrEmpty(commonBank) ? "(multiple)" : string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateVolumeFor(IEnumerable<HitObject> objects, int? newVolume)
|
private void updateAdditionBankState()
|
||||||
{
|
{
|
||||||
if (newVolume == null)
|
string? commonAdditionBank = getCommonAdditionBank();
|
||||||
return;
|
additionBank.PlaceholderText = string.IsNullOrEmpty(commonAdditionBank) ? "(multiple)" : string.Empty;
|
||||||
|
additionBank.Current.Value = commonAdditionBank;
|
||||||
|
|
||||||
|
bool anyAdditions = allRelevantSamples.Any(o => o.Any(s => s.Name != HitSampleInfo.HIT_NORMAL));
|
||||||
|
if (anyAdditions)
|
||||||
|
additionBank.Show();
|
||||||
|
else
|
||||||
|
additionBank.Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Applies the given update action on all samples of <see cref="allRelevantSamples"/>
|
||||||
|
/// and invokes the necessary update notifiers for the beatmap and hit objects.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="updateAction">The action to perform on each element of <see cref="allRelevantSamples"/>.</param>
|
||||||
|
private void updateAllRelevantSamples(Action<HitObject, IList<HitSampleInfo>> updateAction)
|
||||||
|
{
|
||||||
beatmap.BeginChange();
|
beatmap.BeginChange();
|
||||||
|
|
||||||
foreach (var h in objects)
|
foreach (var relevantHitObject in relevantObjects)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < h.Samples.Count; i++)
|
var relevantSamples = GetRelevantSamples(relevantHitObject);
|
||||||
{
|
updateAction(relevantHitObject, relevantSamples);
|
||||||
h.Samples[i] = h.Samples[i].With(newVolume: newVolume.Value);
|
beatmap.Update(relevantHitObject);
|
||||||
}
|
|
||||||
|
|
||||||
beatmap.Update(h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
beatmap.EndChange();
|
beatmap.EndChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setBank(string newBank)
|
||||||
|
{
|
||||||
|
updateAllRelevantSamples((_, relevantSamples) =>
|
||||||
|
{
|
||||||
|
for (int i = 0; i < relevantSamples.Count; i++)
|
||||||
|
{
|
||||||
|
if (relevantSamples[i].Name != HitSampleInfo.HIT_NORMAL) continue;
|
||||||
|
|
||||||
|
relevantSamples[i] = relevantSamples[i].With(newBank: newBank);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setAdditionBank(string newBank)
|
||||||
|
{
|
||||||
|
updateAllRelevantSamples((_, relevantSamples) =>
|
||||||
|
{
|
||||||
|
for (int i = 0; i < relevantSamples.Count; i++)
|
||||||
|
{
|
||||||
|
if (relevantSamples[i].Name == HitSampleInfo.HIT_NORMAL) continue;
|
||||||
|
|
||||||
|
relevantSamples[i] = relevantSamples[i].With(newBank: newBank);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setVolume(int newVolume)
|
||||||
|
{
|
||||||
|
updateAllRelevantSamples((_, relevantSamples) =>
|
||||||
|
{
|
||||||
|
for (int i = 0; i < relevantSamples.Count; i++)
|
||||||
|
{
|
||||||
|
relevantSamples[i] = relevantSamples[i].With(newVolume: newVolume);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#region hitsound toggles
|
||||||
|
|
||||||
|
private readonly Dictionary<string, Bindable<TernaryState>> selectionSampleStates = new Dictionary<string, Bindable<TernaryState>>();
|
||||||
|
|
||||||
|
private readonly List<string> banks = new List<string>();
|
||||||
|
|
||||||
|
private void createStateBindables()
|
||||||
|
{
|
||||||
|
foreach (string sampleName in HitSampleInfo.AllAdditions)
|
||||||
|
{
|
||||||
|
var bindable = new Bindable<TernaryState>
|
||||||
|
{
|
||||||
|
Description = sampleName.Replace("hit", string.Empty).Titleize()
|
||||||
|
};
|
||||||
|
|
||||||
|
bindable.ValueChanged += state =>
|
||||||
|
{
|
||||||
|
switch (state.NewValue)
|
||||||
|
{
|
||||||
|
case TernaryState.False:
|
||||||
|
removeHitSample(sampleName);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TernaryState.True:
|
||||||
|
addHitSample(sampleName);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
selectionSampleStates[sampleName] = bindable;
|
||||||
|
}
|
||||||
|
|
||||||
|
banks.AddRange(HitSampleInfo.AllBanks);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateTernaryStates()
|
||||||
|
{
|
||||||
|
foreach ((string sampleName, var bindable) in selectionSampleStates)
|
||||||
|
{
|
||||||
|
bindable.Value = SelectionHandler<HitObject>.GetStateFromSelection(relevantObjects, h => GetRelevantSamples(h).Any(s => s.Name == sampleName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<TernaryButton> createTernaryButtons()
|
||||||
|
{
|
||||||
|
foreach ((string sampleName, var bindable) in selectionSampleStates)
|
||||||
|
yield return new TernaryButton(bindable, string.Empty, () => ComposeBlueprintContainer.GetIconForSample(sampleName));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addHitSample(string sampleName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(sampleName))
|
||||||
|
return;
|
||||||
|
|
||||||
|
updateAllRelevantSamples((h, relevantSamples) =>
|
||||||
|
{
|
||||||
|
// Make sure there isn't already an existing sample
|
||||||
|
if (relevantSamples.Any(s => s.Name == sampleName))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// First try inheriting the sample info from the node samples instead of the samples of the hitobject
|
||||||
|
var relevantSample = relevantSamples.FirstOrDefault(s => s.Name != HitSampleInfo.HIT_NORMAL) ?? relevantSamples.FirstOrDefault();
|
||||||
|
relevantSamples.Add(relevantSample?.With(sampleName) ?? h.CreateHitSampleInfo(sampleName));
|
||||||
|
});
|
||||||
|
|
||||||
|
updateAdditionBankState();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeHitSample(string sampleName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(sampleName))
|
||||||
|
return;
|
||||||
|
|
||||||
|
updateAllRelevantSamples((_, relevantSamples) =>
|
||||||
|
{
|
||||||
|
for (int i = 0; i < relevantSamples.Count; i++)
|
||||||
|
{
|
||||||
|
if (relevantSamples[i].Name == sampleName)
|
||||||
|
relevantSamples.RemoveAt(i--);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
updateAdditionBankState();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
|
{
|
||||||
|
if (e.ControlPressed || e.AltPressed || e.SuperPressed || !checkRightToggleFromKey(e.Key, out int rightIndex))
|
||||||
|
return base.OnKeyDown(e);
|
||||||
|
|
||||||
|
if (e.ShiftPressed)
|
||||||
|
{
|
||||||
|
string? newBank = banks.ElementAtOrDefault(rightIndex);
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(newBank))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
setBank(newBank);
|
||||||
|
updatePrimaryBankState();
|
||||||
|
setAdditionBank(newBank);
|
||||||
|
updateAdditionBankState();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var item = togglesCollection.ElementAtOrDefault(rightIndex);
|
||||||
|
|
||||||
|
if (item is not DrawableTernaryButton button) return base.OnKeyDown(e);
|
||||||
|
|
||||||
|
button.Button.Toggle();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool checkRightToggleFromKey(Key key, out int index)
|
||||||
|
{
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case Key.W:
|
||||||
|
index = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Key.E:
|
||||||
|
index = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Key.R:
|
||||||
|
index = 2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
index = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return index >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
private readonly Drawable userContent;
|
private readonly Drawable userContent;
|
||||||
|
|
||||||
public readonly Bindable<bool> WaveformVisible = new Bindable<bool>();
|
|
||||||
|
|
||||||
public readonly Bindable<bool> ControlPointsVisible = new Bindable<bool>();
|
|
||||||
|
|
||||||
public readonly Bindable<bool> TicksVisible = new Bindable<bool>();
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private EditorClock editorClock { get; set; }
|
private EditorClock editorClock { get; set; }
|
||||||
|
|
||||||
@ -88,6 +82,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
private Container mainContent;
|
private Container mainContent;
|
||||||
|
|
||||||
private Bindable<float> waveformOpacity;
|
private Bindable<float> waveformOpacity;
|
||||||
|
private Bindable<bool> controlPointsVisible;
|
||||||
|
private Bindable<bool> ticksVisible;
|
||||||
|
|
||||||
private double trackLengthForZoom;
|
private double trackLengthForZoom;
|
||||||
|
|
||||||
@ -139,6 +135,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
});
|
});
|
||||||
|
|
||||||
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
|
waveformOpacity = config.GetBindable<float>(OsuSetting.EditorWaveformOpacity);
|
||||||
|
controlPointsVisible = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTimingChanges);
|
||||||
|
ticksVisible = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTicks);
|
||||||
|
|
||||||
track.BindTo(editorClock.Track);
|
track.BindTo(editorClock.Track);
|
||||||
track.BindValueChanged(_ =>
|
track.BindValueChanged(_ =>
|
||||||
@ -168,12 +166,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
WaveformVisible.BindValueChanged(_ => updateWaveformOpacity());
|
|
||||||
waveformOpacity.BindValueChanged(_ => updateWaveformOpacity(), true);
|
waveformOpacity.BindValueChanged(_ => updateWaveformOpacity(), true);
|
||||||
|
|
||||||
TicksVisible.BindValueChanged(visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint), true);
|
ticksVisible.BindValueChanged(visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint), true);
|
||||||
|
|
||||||
ControlPointsVisible.BindValueChanged(visible =>
|
controlPointsVisible.BindValueChanged(visible =>
|
||||||
{
|
{
|
||||||
if (visible.NewValue)
|
if (visible.NewValue)
|
||||||
{
|
{
|
||||||
@ -195,7 +192,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateWaveformOpacity() =>
|
private void updateWaveformOpacity() =>
|
||||||
waveform.FadeTo(WaveformVisible.Value ? waveformOpacity.Value : 0, 200, Easing.OutQuint);
|
waveform.FadeTo(waveformOpacity.Value, 200, Easing.OutQuint);
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
|
@ -2,15 +2,13 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
using osu.Game.Localisation;
|
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -22,6 +20,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
private readonly Drawable userContent;
|
private readonly Drawable userContent;
|
||||||
|
|
||||||
|
private Box timelineBackground = null!;
|
||||||
|
private readonly Bindable<bool> composerFocusMode = new Bindable<bool>();
|
||||||
|
|
||||||
public TimelineArea(Drawable? content = null)
|
public TimelineArea(Drawable? content = null)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
@ -31,16 +32,20 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider, OsuColour colours)
|
private void load(OverlayColourProvider colourProvider, OsuColour colours, Editor? editor)
|
||||||
{
|
{
|
||||||
OsuCheckbox waveformCheckbox;
|
|
||||||
OsuCheckbox controlPointsCheckbox;
|
|
||||||
OsuCheckbox ticksCheckbox;
|
|
||||||
|
|
||||||
const float padding = 10;
|
const float padding = 10;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
Width = 35 + HitObjectComposer.TOOLBOX_CONTRACTED_SIZE_RIGHT,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Colour = colourProvider.Background4
|
||||||
|
},
|
||||||
new GridContainer
|
new GridContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -51,70 +56,21 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
},
|
},
|
||||||
ColumnDimensions = new[]
|
ColumnDimensions = new[]
|
||||||
{
|
{
|
||||||
new Dimension(GridSizeMode.Absolute, 135),
|
|
||||||
new Dimension(),
|
new Dimension(),
|
||||||
new Dimension(GridSizeMode.Absolute, 35),
|
new Dimension(GridSizeMode.Absolute, 35),
|
||||||
new Dimension(GridSizeMode.Absolute, HitObjectComposer.TOOLBOX_CONTRACTED_SIZE_RIGHT - padding * 2),
|
new Dimension(GridSizeMode.Absolute, HitObjectComposer.TOOLBOX_CONTRACTED_SIZE_RIGHT),
|
||||||
},
|
},
|
||||||
Content = new[]
|
Content = new[]
|
||||||
{
|
{
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Name = @"Toggle controls",
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = colourProvider.Background2,
|
|
||||||
},
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Padding = new MarginPadding(padding),
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Spacing = new Vector2(0, 4),
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
waveformCheckbox = new OsuCheckbox(nubSize: 30f)
|
|
||||||
{
|
|
||||||
LabelText = EditorStrings.TimelineWaveform,
|
|
||||||
Current = { Value = true },
|
|
||||||
},
|
|
||||||
ticksCheckbox = new OsuCheckbox(nubSize: 30f)
|
|
||||||
{
|
|
||||||
LabelText = EditorStrings.TimelineTicks,
|
|
||||||
Current = { Value = true },
|
|
||||||
},
|
|
||||||
controlPointsCheckbox = new OsuCheckbox(nubSize: 30f)
|
|
||||||
{
|
|
||||||
LabelText = BeatmapsetsStrings.ShowStatsBpm,
|
|
||||||
Current = { Value = true },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
// the out-of-bounds portion of the centre marker.
|
timelineBackground = new Box
|
||||||
new Box
|
|
||||||
{
|
|
||||||
Width = 24,
|
|
||||||
Height = EditorScreenWithTimeline.PADDING,
|
|
||||||
Depth = float.MaxValue,
|
|
||||||
Colour = colours.Red1,
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Origin = Anchor.BottomCentre,
|
|
||||||
},
|
|
||||||
new Box
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Depth = float.MaxValue,
|
Depth = float.MaxValue,
|
||||||
@ -168,9 +124,15 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Timeline.WaveformVisible.BindTo(waveformCheckbox.Current);
|
if (editor != null)
|
||||||
Timeline.ControlPointsVisible.BindTo(controlPointsCheckbox.Current);
|
composerFocusMode.BindTo(editor.ComposerFocusMode);
|
||||||
Timeline.TicksVisible.BindTo(ticksCheckbox.Current);
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
composerFocusMode.BindValueChanged(_ => timelineBackground.FadeTo(composerFocusMode.Value ? 0.5f : 1, 400, Easing.OutQuint), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,224 @@
|
|||||||
|
// 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;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Beatmaps.Timing;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||||
|
{
|
||||||
|
public partial class TimelineBreak : CompositeDrawable
|
||||||
|
{
|
||||||
|
public Bindable<BreakPeriod> Break { get; } = new Bindable<BreakPeriod>();
|
||||||
|
|
||||||
|
public TimelineBreak(BreakPeriod b)
|
||||||
|
{
|
||||||
|
Break.Value = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
RelativePositionAxes = Axes.X;
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
Origin = Anchor.TopLeft;
|
||||||
|
Padding = new MarginPadding { Horizontal = -5 };
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Padding = new MarginPadding { Horizontal = 5 },
|
||||||
|
Child = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colours.Gray5,
|
||||||
|
Alpha = 0.7f,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
new DragHandle(isStartHandle: true)
|
||||||
|
{
|
||||||
|
Break = { BindTarget = Break },
|
||||||
|
Anchor = Anchor.TopLeft,
|
||||||
|
Origin = Anchor.TopLeft,
|
||||||
|
Action = (time, breakPeriod) => new ManualBreakPeriod(time, breakPeriod.EndTime),
|
||||||
|
},
|
||||||
|
new DragHandle(isStartHandle: false)
|
||||||
|
{
|
||||||
|
Break = { BindTarget = Break },
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
Action = (time, breakPeriod) => new ManualBreakPeriod(breakPeriod.StartTime, time),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
Break.BindValueChanged(_ =>
|
||||||
|
{
|
||||||
|
X = (float)Break.Value.StartTime;
|
||||||
|
Width = (float)Break.Value.Duration;
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private partial class DragHandle : FillFlowContainer
|
||||||
|
{
|
||||||
|
public Bindable<BreakPeriod> Break { get; } = new Bindable<BreakPeriod>();
|
||||||
|
|
||||||
|
public new Anchor Anchor
|
||||||
|
{
|
||||||
|
get => base.Anchor;
|
||||||
|
init => base.Anchor = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Func<double, BreakPeriod, BreakPeriod>? Action { get; init; }
|
||||||
|
|
||||||
|
private readonly bool isStartHandle;
|
||||||
|
|
||||||
|
private Container handle = null!;
|
||||||
|
private (double min, double max)? allowedDragRange;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private EditorBeatmap beatmap { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Timeline timeline { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IEditorChangeHandler? changeHandler { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuColour colours { get; set; } = null!;
|
||||||
|
|
||||||
|
public DragHandle(bool isStartHandle)
|
||||||
|
{
|
||||||
|
this.isStartHandle = isStartHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.X;
|
||||||
|
RelativeSizeAxes = Axes.Y;
|
||||||
|
Direction = FillDirection.Horizontal;
|
||||||
|
Spacing = new Vector2(5);
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
handle = new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor,
|
||||||
|
Origin = Anchor,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
CornerRadius = 5,
|
||||||
|
Masking = true,
|
||||||
|
Child = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Colour4.White,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
BypassAutoSizeAxes = Axes.X,
|
||||||
|
Anchor = Anchor,
|
||||||
|
Origin = Anchor,
|
||||||
|
Text = "Break",
|
||||||
|
Margin = new MarginPadding { Top = 2, },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
updateState();
|
||||||
|
FinishTransforms(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
{
|
||||||
|
updateState();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
|
{
|
||||||
|
updateState();
|
||||||
|
base.OnHoverLost(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnDragStart(DragStartEvent e)
|
||||||
|
{
|
||||||
|
changeHandler?.BeginChange();
|
||||||
|
updateState();
|
||||||
|
|
||||||
|
double min = beatmap.HitObjects.Last(ho => ho.GetEndTime() <= Break.Value.StartTime).GetEndTime();
|
||||||
|
double max = beatmap.HitObjects.First(ho => ho.StartTime >= Break.Value.EndTime).StartTime;
|
||||||
|
|
||||||
|
if (isStartHandle)
|
||||||
|
max = Math.Min(max, Break.Value.EndTime - BreakPeriod.MIN_BREAK_DURATION);
|
||||||
|
else
|
||||||
|
min = Math.Max(min, Break.Value.StartTime + BreakPeriod.MIN_BREAK_DURATION);
|
||||||
|
|
||||||
|
allowedDragRange = (min, max);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDrag(DragEvent e)
|
||||||
|
{
|
||||||
|
base.OnDrag(e);
|
||||||
|
|
||||||
|
Debug.Assert(allowedDragRange != null);
|
||||||
|
|
||||||
|
if (Action != null
|
||||||
|
&& timeline.FindSnappedPositionAndTime(e.ScreenSpaceMousePosition).Time is double time
|
||||||
|
&& time > allowedDragRange.Value.min
|
||||||
|
&& time < allowedDragRange.Value.max)
|
||||||
|
{
|
||||||
|
int index = beatmap.Breaks.IndexOf(Break.Value);
|
||||||
|
beatmap.Breaks[index] = Break.Value = Action.Invoke(time, Break.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateState();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDragEnd(DragEndEvent e)
|
||||||
|
{
|
||||||
|
changeHandler?.EndChange();
|
||||||
|
updateState();
|
||||||
|
base.OnDragEnd(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateState()
|
||||||
|
{
|
||||||
|
bool active = IsHovered || IsDragged;
|
||||||
|
|
||||||
|
var colour = colours.Gray8;
|
||||||
|
if (active)
|
||||||
|
colour = colour.Lighten(0.3f);
|
||||||
|
|
||||||
|
this.FadeColour(colour, 400, Easing.OutQuint);
|
||||||
|
handle.ResizeWidthTo(active ? 20 : 10, 400, Easing.OutElasticHalf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,80 @@
|
|||||||
|
// 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.Specialized;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Caching;
|
||||||
|
using osu.Game.Beatmaps.Timing;
|
||||||
|
using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||||
|
{
|
||||||
|
public partial class TimelineBreakDisplay : TimelinePart<TimelineBreak>
|
||||||
|
{
|
||||||
|
[Resolved]
|
||||||
|
private Timeline timeline { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The visible time/position range of the timeline.
|
||||||
|
/// </summary>
|
||||||
|
private (float min, float max) visibleRange = (float.MinValue, float.MaxValue);
|
||||||
|
|
||||||
|
private readonly Cached breakCache = new Cached();
|
||||||
|
|
||||||
|
private readonly BindableList<BreakPeriod> breaks = new BindableList<BreakPeriod>();
|
||||||
|
|
||||||
|
protected override void LoadBeatmap(EditorBeatmap beatmap)
|
||||||
|
{
|
||||||
|
base.LoadBeatmap(beatmap);
|
||||||
|
|
||||||
|
breaks.UnbindAll();
|
||||||
|
breaks.BindTo(beatmap.Breaks);
|
||||||
|
breaks.BindCollectionChanged((_, e) =>
|
||||||
|
{
|
||||||
|
if (e.Action != NotifyCollectionChangedAction.Replace)
|
||||||
|
breakCache.Invalidate();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
if (DrawWidth <= 0) return;
|
||||||
|
|
||||||
|
(float, float) newRange = (
|
||||||
|
(ToLocalSpace(timeline.ScreenSpaceDrawQuad.TopLeft).X) / DrawWidth * Content.RelativeChildSize.X,
|
||||||
|
(ToLocalSpace(timeline.ScreenSpaceDrawQuad.TopRight).X) / DrawWidth * Content.RelativeChildSize.X);
|
||||||
|
|
||||||
|
if (visibleRange != newRange)
|
||||||
|
{
|
||||||
|
visibleRange = newRange;
|
||||||
|
breakCache.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!breakCache.IsValid)
|
||||||
|
{
|
||||||
|
recreateBreaks();
|
||||||
|
breakCache.Validate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void recreateBreaks()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
|
||||||
|
for (int i = 0; i < breaks.Count; i++)
|
||||||
|
{
|
||||||
|
var breakPeriod = breaks[i];
|
||||||
|
|
||||||
|
if (!shouldBeVisible(breakPeriod))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Add(new TimelineBreak(breakPeriod));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool shouldBeVisible(BreakPeriod breakPeriod) => breakPeriod.EndTime >= visibleRange.min && breakPeriod.StartTime <= visibleRange.max;
|
||||||
|
}
|
||||||
|
}
|
@ -50,6 +50,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
private readonly Border border;
|
private readonly Border border;
|
||||||
|
|
||||||
private readonly Container colouredComponents;
|
private readonly Container colouredComponents;
|
||||||
|
private readonly Container sampleComponents;
|
||||||
private readonly OsuSpriteText comboIndexText;
|
private readonly OsuSpriteText comboIndexText;
|
||||||
private readonly SamplePointPiece samplePointPiece;
|
private readonly SamplePointPiece samplePointPiece;
|
||||||
private readonly DifficultyPointPiece? difficultyPointPiece;
|
private readonly DifficultyPointPiece? difficultyPointPiece;
|
||||||
@ -107,7 +108,13 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
samplePointPiece = new SamplePointPiece(Item)
|
samplePointPiece = new SamplePointPiece(Item)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.TopCentre
|
Origin = Anchor.TopCentre,
|
||||||
|
RelativePositionAxes = Axes.X,
|
||||||
|
AlternativeColor = Item is IHasRepeats
|
||||||
|
},
|
||||||
|
sampleComponents = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -236,6 +243,22 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
X = (float)(i + 1) / (repeats.RepeatCount + 1)
|
X = (float)(i + 1) / (repeats.RepeatCount + 1)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add node sample pieces
|
||||||
|
sampleComponents.Clear();
|
||||||
|
|
||||||
|
for (int i = 0; i < repeats.RepeatCount + 2; i++)
|
||||||
|
{
|
||||||
|
sampleComponents.Add(new NodeSamplePointPiece(Item, i)
|
||||||
|
{
|
||||||
|
X = (float)i / (repeats.RepeatCount + 1),
|
||||||
|
RelativePositionAxes = Axes.X,
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.TopCentre
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
samplePointPiece.X = 1f / (repeats.RepeatCount + 1) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool ShouldBeConsideredForInput(Drawable child) => true;
|
protected override bool ShouldBeConsideredForInput(Drawable child) => true;
|
||||||
|
@ -69,7 +69,15 @@ namespace osu.Game.Screens.Edit.Compose
|
|||||||
if (ruleset == null || composer == null)
|
if (ruleset == null || composer == null)
|
||||||
return base.CreateTimelineContent();
|
return base.CreateTimelineContent();
|
||||||
|
|
||||||
return wrapSkinnableContent(new TimelineBlueprintContainer(composer));
|
return wrapSkinnableContent(new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new TimelineBlueprintContainer(composer),
|
||||||
|
new TimelineBreakDisplay { RelativeSizeAxes = Axes.Both, },
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable wrapSkinnableContent(Drawable content)
|
private Drawable wrapSkinnableContent(Drawable content)
|
||||||
|
@ -211,6 +211,14 @@ namespace osu.Game.Screens.Edit
|
|||||||
private Bindable<bool> editorHitMarkers;
|
private Bindable<bool> editorHitMarkers;
|
||||||
private Bindable<bool> editorAutoSeekOnPlacement;
|
private Bindable<bool> editorAutoSeekOnPlacement;
|
||||||
private Bindable<bool> editorLimitedDistanceSnap;
|
private Bindable<bool> editorLimitedDistanceSnap;
|
||||||
|
private Bindable<bool> editorTimelineShowTimingChanges;
|
||||||
|
private Bindable<bool> editorTimelineShowTicks;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This controls the opacity of components like the timelines, sidebars, etc.
|
||||||
|
/// In "composer focus" mode the opacity of the aforementioned components is reduced so that the user can focus on the composer better.
|
||||||
|
/// </summary>
|
||||||
|
public Bindable<bool> ComposerFocusMode { get; } = new Bindable<bool>();
|
||||||
|
|
||||||
public Editor(EditorLoader loader = null)
|
public Editor(EditorLoader loader = null)
|
||||||
{
|
{
|
||||||
@ -305,6 +313,8 @@ namespace osu.Game.Screens.Edit
|
|||||||
editorHitMarkers = config.GetBindable<bool>(OsuSetting.EditorShowHitMarkers);
|
editorHitMarkers = config.GetBindable<bool>(OsuSetting.EditorShowHitMarkers);
|
||||||
editorAutoSeekOnPlacement = config.GetBindable<bool>(OsuSetting.EditorAutoSeekOnPlacement);
|
editorAutoSeekOnPlacement = config.GetBindable<bool>(OsuSetting.EditorAutoSeekOnPlacement);
|
||||||
editorLimitedDistanceSnap = config.GetBindable<bool>(OsuSetting.EditorLimitedDistanceSnap);
|
editorLimitedDistanceSnap = config.GetBindable<bool>(OsuSetting.EditorLimitedDistanceSnap);
|
||||||
|
editorTimelineShowTimingChanges = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTimingChanges);
|
||||||
|
editorTimelineShowTicks = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTicks);
|
||||||
|
|
||||||
AddInternal(new OsuContextMenuContainer
|
AddInternal(new OsuContextMenuContainer
|
||||||
{
|
{
|
||||||
@ -319,7 +329,6 @@ namespace osu.Game.Screens.Edit
|
|||||||
Child = screenContainer = new Container<EditorScreen>
|
Child = screenContainer = new Container<EditorScreen>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
@ -355,9 +364,23 @@ namespace osu.Game.Screens.Edit
|
|||||||
},
|
},
|
||||||
new MenuItem(CommonStrings.MenuBarView)
|
new MenuItem(CommonStrings.MenuBarView)
|
||||||
{
|
{
|
||||||
Items = new MenuItem[]
|
Items = new[]
|
||||||
{
|
{
|
||||||
new WaveformOpacityMenuItem(config.GetBindable<float>(OsuSetting.EditorWaveformOpacity)),
|
new MenuItem(EditorStrings.Timeline)
|
||||||
|
{
|
||||||
|
Items =
|
||||||
|
[
|
||||||
|
new WaveformOpacityMenuItem(config.GetBindable<float>(OsuSetting.EditorWaveformOpacity)),
|
||||||
|
new ToggleMenuItem(EditorStrings.TimelineShowTimingChanges)
|
||||||
|
{
|
||||||
|
State = { BindTarget = editorTimelineShowTimingChanges }
|
||||||
|
},
|
||||||
|
new ToggleMenuItem(EditorStrings.TimelineShowTicks)
|
||||||
|
{
|
||||||
|
State = { BindTarget = editorTimelineShowTicks }
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
new BackgroundDimMenuItem(editorBackgroundDim),
|
new BackgroundDimMenuItem(editorBackgroundDim),
|
||||||
new ToggleMenuItem(EditorStrings.ShowHitMarkers)
|
new ToggleMenuItem(EditorStrings.ShowHitMarkers)
|
||||||
{
|
{
|
||||||
@ -996,6 +1019,15 @@ namespace osu.Game.Screens.Edit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Forces a reload of the compose screen after significant configuration changes.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This can be necessary for scrolling rulesets, as they do not easily support control points changing under them.
|
||||||
|
/// The reason that this works is that <see cref="onModeChanged"/> will re-instantiate the screen whenever it is requested next.
|
||||||
|
/// </remarks>
|
||||||
|
public void ReloadComposeScreen() => screenContainer.SingleOrDefault(s => s.Type == EditorScreenMode.Compose)?.RemoveAndDisposeImmediately();
|
||||||
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private ScheduledDelegate playbackDisabledDebounce;
|
private ScheduledDelegate playbackDisabledDebounce;
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
BeatmapSkin.BeatmapSkinChanged += SaveState;
|
BeatmapSkin.BeatmapSkinChanged += SaveState;
|
||||||
}
|
}
|
||||||
|
|
||||||
beatmapProcessor = playableBeatmap.BeatmapInfo.Ruleset.CreateInstance().CreateBeatmapProcessor(this);
|
beatmapProcessor = new EditorBeatmapProcessor(this, playableBeatmap.BeatmapInfo.Ruleset.CreateInstance());
|
||||||
|
|
||||||
foreach (var obj in HitObjects)
|
foreach (var obj in HitObjects)
|
||||||
trackStartTime(obj);
|
trackStartTime(obj);
|
||||||
@ -172,7 +172,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
set => PlayableBeatmap.ControlPointInfo = value;
|
set => PlayableBeatmap.ControlPointInfo = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BreakPeriod> Breaks => PlayableBeatmap.Breaks;
|
public BindableList<BreakPeriod> Breaks => PlayableBeatmap.Breaks;
|
||||||
|
|
||||||
public List<string> UnhandledEventLines => PlayableBeatmap.UnhandledEventLines;
|
public List<string> UnhandledEventLines => PlayableBeatmap.UnhandledEventLines;
|
||||||
|
|
||||||
@ -349,13 +349,13 @@ namespace osu.Game.Screens.Edit
|
|||||||
if (batchPendingUpdates.Count == 0 && batchPendingDeletes.Count == 0 && batchPendingInserts.Count == 0)
|
if (batchPendingUpdates.Count == 0 && batchPendingDeletes.Count == 0 && batchPendingInserts.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
beatmapProcessor?.PreProcess();
|
beatmapProcessor.PreProcess();
|
||||||
|
|
||||||
foreach (var h in batchPendingDeletes) processHitObject(h);
|
foreach (var h in batchPendingDeletes) processHitObject(h);
|
||||||
foreach (var h in batchPendingInserts) processHitObject(h);
|
foreach (var h in batchPendingInserts) processHitObject(h);
|
||||||
foreach (var h in batchPendingUpdates) processHitObject(h);
|
foreach (var h in batchPendingUpdates) processHitObject(h);
|
||||||
|
|
||||||
beatmapProcessor?.PostProcess();
|
beatmapProcessor.PostProcess();
|
||||||
|
|
||||||
BeatmapReprocessed?.Invoke();
|
BeatmapReprocessed?.Invoke();
|
||||||
|
|
||||||
|
70
osu.Game/Screens/Edit/EditorBeatmapProcessor.cs
Normal file
70
osu.Game/Screens/Edit/EditorBeatmapProcessor.cs
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
// 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;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.Timing;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Edit
|
||||||
|
{
|
||||||
|
public class EditorBeatmapProcessor : IBeatmapProcessor
|
||||||
|
{
|
||||||
|
public IBeatmap Beatmap { get; }
|
||||||
|
|
||||||
|
private readonly IBeatmapProcessor? rulesetBeatmapProcessor;
|
||||||
|
|
||||||
|
public EditorBeatmapProcessor(IBeatmap beatmap, Ruleset ruleset)
|
||||||
|
{
|
||||||
|
Beatmap = beatmap;
|
||||||
|
rulesetBeatmapProcessor = ruleset.CreateBeatmapProcessor(beatmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PreProcess()
|
||||||
|
{
|
||||||
|
rulesetBeatmapProcessor?.PreProcess();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PostProcess()
|
||||||
|
{
|
||||||
|
rulesetBeatmapProcessor?.PostProcess();
|
||||||
|
|
||||||
|
autoGenerateBreaks();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void autoGenerateBreaks()
|
||||||
|
{
|
||||||
|
Beatmap.Breaks.RemoveAll(b => b is not ManualBreakPeriod);
|
||||||
|
|
||||||
|
foreach (var manualBreak in Beatmap.Breaks.ToList())
|
||||||
|
{
|
||||||
|
if (Beatmap.HitObjects.Any(ho => ho.StartTime <= manualBreak.EndTime && ho.GetEndTime() >= manualBreak.StartTime))
|
||||||
|
Beatmap.Breaks.Remove(manualBreak);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i < Beatmap.HitObjects.Count; ++i)
|
||||||
|
{
|
||||||
|
double previousObjectEndTime = Beatmap.HitObjects[i - 1].GetEndTime();
|
||||||
|
double nextObjectStartTime = Beatmap.HitObjects[i].StartTime;
|
||||||
|
|
||||||
|
if (nextObjectStartTime - previousObjectEndTime < BreakPeriod.MIN_GAP_DURATION)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
double breakStartTime = previousObjectEndTime + BreakPeriod.GAP_BEFORE_BREAK;
|
||||||
|
double breakEndTime = nextObjectStartTime - Math.Max(BreakPeriod.GAP_AFTER_BREAK, Beatmap.ControlPointInfo.TimingPointAt(nextObjectStartTime).BeatLength * 2);
|
||||||
|
|
||||||
|
if (breakEndTime - breakStartTime < BreakPeriod.MIN_BREAK_DURATION)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var breakPeriod = new BreakPeriod(breakStartTime, breakEndTime);
|
||||||
|
|
||||||
|
if (Beatmap.Breaks.Any(b => b.Intersects(breakPeriod)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Beatmap.Breaks.Add(breakPeriod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,6 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||||
@ -52,17 +51,11 @@ namespace osu.Game.Screens.Edit
|
|||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = colourProvider.Background4
|
|
||||||
},
|
|
||||||
new GridContainer
|
new GridContainer
|
||||||
{
|
{
|
||||||
Name = "Timeline content",
|
Name = "Timeline content",
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Padding = new MarginPadding { Horizontal = PADDING, Top = PADDING },
|
|
||||||
Content = new[]
|
Content = new[]
|
||||||
{
|
{
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
|
@ -45,6 +45,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
editorBeatmap.BeginChange();
|
editorBeatmap.BeginChange();
|
||||||
processHitObjects(result, () => newBeatmap ??= readBeatmap(newState));
|
processHitObjects(result, () => newBeatmap ??= readBeatmap(newState));
|
||||||
processTimingPoints(() => newBeatmap ??= readBeatmap(newState));
|
processTimingPoints(() => newBeatmap ??= readBeatmap(newState));
|
||||||
|
processBreaks(() => newBeatmap ??= readBeatmap(newState));
|
||||||
processHitObjectLocalData(() => newBeatmap ??= readBeatmap(newState));
|
processHitObjectLocalData(() => newBeatmap ??= readBeatmap(newState));
|
||||||
editorBeatmap.EndChange();
|
editorBeatmap.EndChange();
|
||||||
}
|
}
|
||||||
@ -75,6 +76,27 @@ namespace osu.Game.Screens.Edit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void processBreaks(Func<IBeatmap> getNewBeatmap)
|
||||||
|
{
|
||||||
|
var newBreaks = getNewBeatmap().Breaks.ToArray();
|
||||||
|
|
||||||
|
foreach (var oldBreak in editorBeatmap.Breaks.ToArray())
|
||||||
|
{
|
||||||
|
if (newBreaks.Any(b => b.Equals(oldBreak)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
editorBeatmap.Breaks.Remove(oldBreak);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var newBreak in newBreaks)
|
||||||
|
{
|
||||||
|
if (editorBeatmap.Breaks.Any(b => b.Equals(newBreak)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
editorBeatmap.Breaks.Add(newBreak);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void processHitObjects(DiffResult result, Func<IBeatmap> getNewBeatmap)
|
private void processHitObjects(DiffResult result, Func<IBeatmap> getNewBeatmap)
|
||||||
{
|
{
|
||||||
findChangedIndices(result, LegacyDecoder<Beatmap>.Section.HitObjects, out var removedIndices, out var addedIndices);
|
findChangedIndices(result, LegacyDecoder<Beatmap>.Section.HitObjects, out var removedIndices, out var addedIndices);
|
||||||
|
15
osu.Game/Screens/Edit/ManualBreakPeriod.cs
Normal file
15
osu.Game/Screens/Edit/ManualBreakPeriod.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// 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 osu.Game.Beatmaps.Timing;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Edit
|
||||||
|
{
|
||||||
|
public class ManualBreakPeriod : BreakPeriod
|
||||||
|
{
|
||||||
|
public ManualBreakPeriod(double startTime, double endTime)
|
||||||
|
: base(startTime, endTime)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -45,7 +45,7 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
OnFocused?.Invoke();
|
OnFocused?.Invoke();
|
||||||
base.OnFocus(e);
|
base.OnFocus(e);
|
||||||
|
|
||||||
GetContainingFocusManager().TriggerFocusContention(this);
|
GetContainingFocusManager()!.TriggerFocusContention(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(ArtistTextBox.Current.Value))
|
if (string.IsNullOrEmpty(ArtistTextBox.Current.Value))
|
||||||
ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(ArtistTextBox));
|
ScheduleAfterChildren(() => GetContainingFocusManager()!.ChangeFocus(ArtistTextBox));
|
||||||
|
|
||||||
ArtistTextBox.Current.BindValueChanged(artist => transferIfRomanised(artist.NewValue, RomanisedArtistTextBox));
|
ArtistTextBox.Current.BindValueChanged(artist => transferIfRomanised(artist.NewValue, RomanisedArtistTextBox));
|
||||||
TitleTextBox.Current.BindValueChanged(title => transferIfRomanised(title.NewValue, RomanisedTitleTextBox));
|
TitleTextBox.Current.BindValueChanged(title => transferIfRomanised(title.NewValue, RomanisedTitleTextBox));
|
||||||
|
@ -126,7 +126,7 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
protected override void OnFocus(FocusEvent e)
|
protected override void OnFocus(FocusEvent e)
|
||||||
{
|
{
|
||||||
base.OnFocus(e);
|
base.OnFocus(e);
|
||||||
GetContainingFocusManager().ChangeFocus(textBox);
|
GetContainingFocusManager()!.ChangeFocus(textBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateState()
|
private void updateState()
|
||||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Screens.Edit.Verify
|
|||||||
if (issue.Time != null)
|
if (issue.Time != null)
|
||||||
{
|
{
|
||||||
clock.Seek(issue.Time.Value);
|
clock.Seek(issue.Time.Value);
|
||||||
editor.OnPressed(new KeyBindingPressEvent<GlobalAction>(GetContainingInputManager().CurrentState, GlobalAction.EditorComposeMode));
|
editor.OnPressed(new KeyBindingPressEvent<GlobalAction>(GetContainingInputManager()!.CurrentState, GlobalAction.EditorComposeMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!issue.HitObjects.Any())
|
if (!issue.HitObjects.Any())
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user