mirror of
https://github.com/ppy/osu.git
synced 2025-03-12 17:57:21 +08:00
Merge branch 'master' into navigate-to-timestamp
This commit is contained in:
commit
5551bae7ce
@ -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.
|
||||||
|
@ -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;
|
||||||
|
@ -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[]
|
||||||
|
@ -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");
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
@ -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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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();
|
if (string.IsNullOrEmpty(val.NewValue))
|
||||||
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;
|
return;
|
||||||
|
|
||||||
beatmap.BeginChange();
|
setAdditionBank(val.NewValue);
|
||||||
|
updateAdditionBankState();
|
||||||
|
});
|
||||||
|
additionBank.OnCommit += (_, _) => updateAdditionBankState();
|
||||||
|
|
||||||
foreach (var h in objects)
|
volume.Current.BindValueChanged(val =>
|
||||||
{
|
{
|
||||||
for (int i = 0; i < h.Samples.Count; i++)
|
if (val.NewValue != null)
|
||||||
{
|
setVolume(val.NewValue.Value);
|
||||||
h.Samples[i] = h.Samples[i].With(newBank: newBank);
|
});
|
||||||
|
|
||||||
|
createStateBindables();
|
||||||
|
updateTernaryStates();
|
||||||
|
togglesCollection.AddRange(createTernaryButtons().Select(b => new DrawableTernaryButton(b) { RelativeSizeAxes = Axes.None, Size = new Vector2(40, 40) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
beatmap.Update(h);
|
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;
|
||||||
|
|
||||||
beatmap.EndChange();
|
private void updatePrimaryBankState()
|
||||||
}
|
|
||||||
|
|
||||||
private void updateBankPlaceholderText(IEnumerable<HitObject> objects)
|
|
||||||
{
|
{
|
||||||
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;
|
||||||
|
|
||||||
beatmap.BeginChange();
|
bool anyAdditions = allRelevantSamples.Any(o => o.Any(s => s.Name != HitSampleInfo.HIT_NORMAL));
|
||||||
|
if (anyAdditions)
|
||||||
foreach (var h in objects)
|
additionBank.Show();
|
||||||
{
|
else
|
||||||
for (int i = 0; i < h.Samples.Count; i++)
|
additionBank.Hide();
|
||||||
{
|
|
||||||
h.Samples[i] = h.Samples[i].With(newVolume: newVolume.Value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
beatmap.Update(h);
|
/// <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();
|
||||||
|
|
||||||
|
foreach (var relevantHitObject in relevantObjects)
|
||||||
|
{
|
||||||
|
var relevantSamples = GetRelevantSamples(relevantHitObject);
|
||||||
|
updateAction(relevantHitObject, relevantSamples);
|
||||||
|
beatmap.Update(relevantHitObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
@ -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())
|
||||||
|
@ -248,21 +248,21 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(passwordTextBox));
|
ScheduleAfterChildren(() => GetContainingFocusManager()!.ChangeFocus(passwordTextBox));
|
||||||
passwordTextBox.OnCommit += (_, _) => performJoin();
|
passwordTextBox.OnCommit += (_, _) => performJoin();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void performJoin()
|
private void performJoin()
|
||||||
{
|
{
|
||||||
lounge?.Join(room, passwordTextBox.Text, null, joinFailed);
|
lounge?.Join(room, passwordTextBox.Text, null, joinFailed);
|
||||||
GetContainingFocusManager().TriggerFocusContention(passwordTextBox);
|
GetContainingFocusManager()?.TriggerFocusContention(passwordTextBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void joinFailed(string error) => Schedule(() =>
|
private void joinFailed(string error) => Schedule(() =>
|
||||||
{
|
{
|
||||||
passwordTextBox.Text = string.Empty;
|
passwordTextBox.Text = string.Empty;
|
||||||
|
|
||||||
GetContainingFocusManager().ChangeFocus(passwordTextBox);
|
GetContainingFocusManager()!.ChangeFocus(passwordTextBox);
|
||||||
|
|
||||||
errorText.Text = error;
|
errorText.Text = error;
|
||||||
errorText
|
errorText
|
||||||
|
@ -249,7 +249,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
inputManager = GetContainingInputManager();
|
inputManager = GetContainingInputManager()!;
|
||||||
|
|
||||||
showStoryboards.BindValueChanged(val => epilepsyWarning?.FadeTo(val.NewValue ? 1 : 0, 250, Easing.OutQuint), true);
|
showStoryboards.BindValueChanged(val => epilepsyWarning?.FadeTo(val.NewValue ? 1 : 0, 250, Easing.OutQuint), true);
|
||||||
epilepsyWarning?.FinishTransforms(true);
|
epilepsyWarning?.FinishTransforms(true);
|
||||||
|
@ -1279,7 +1279,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
// we need to block right click absolute scrolling when hovering a carousel item so context menus can display.
|
// we need to block right click absolute scrolling when hovering a carousel item so context menus can display.
|
||||||
// this can be reconsidered when we have an alternative to right click scrolling.
|
// this can be reconsidered when we have an alternative to right click scrolling.
|
||||||
if (GetContainingInputManager().HoveredDrawables.OfType<DrawableCarouselItem>().Any())
|
if (GetContainingInputManager()!.HoveredDrawables.OfType<DrawableCarouselItem>().Any())
|
||||||
{
|
{
|
||||||
rightMouseScrollBlocked = true;
|
rightMouseScrollBlocked = true;
|
||||||
return false;
|
return false;
|
||||||
|
@ -245,7 +245,7 @@ namespace osu.Game.Screens.Select
|
|||||||
searchTextBox.ReadOnly = true;
|
searchTextBox.ReadOnly = true;
|
||||||
searchTextBox.HoldFocus = false;
|
searchTextBox.HoldFocus = false;
|
||||||
if (searchTextBox.HasFocus)
|
if (searchTextBox.HasFocus)
|
||||||
GetContainingFocusManager().ChangeFocus(searchTextBox);
|
GetContainingFocusManager()!.ChangeFocus(searchTextBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Activate()
|
public void Activate()
|
||||||
|
@ -95,7 +95,7 @@ namespace osu.Game.Screens.Select
|
|||||||
modsAtGameplayStart = Mods.Value;
|
modsAtGameplayStart = Mods.Value;
|
||||||
|
|
||||||
// Ctrl+Enter should start map with autoplay enabled.
|
// Ctrl+Enter should start map with autoplay enabled.
|
||||||
if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true)
|
if (GetContainingInputManager()?.CurrentState?.Keyboard.ControlPressed == true)
|
||||||
{
|
{
|
||||||
var autoInstance = getAutoplayMod();
|
var autoInstance = getAutoplayMod();
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ namespace osu.Game.Screens.SelectV2.Footer
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(this));
|
ScheduleAfterChildren(() => GetContainingFocusManager()!.ChangeFocus(this));
|
||||||
|
|
||||||
beatmap.BindValueChanged(_ => Hide());
|
beatmap.BindValueChanged(_ => Hide());
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Screens.Utility.SampleComponents
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
inputManager = GetContainingInputManager();
|
inputManager = GetContainingInputManager()!;
|
||||||
IsActive.BindTo(latencyArea.IsActiveArea);
|
IsActive.BindTo(latencyArea.IsActiveArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Realm" Version="11.5.0" />
|
<PackageReference Include="Realm" Version="11.5.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2024.528.1" />
|
<PackageReference Include="ppy.osu.Framework" Version="2024.618.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.517.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.517.0" />
|
||||||
<PackageReference Include="Sentry" Version="4.3.0" />
|
<PackageReference Include="Sentry" Version="4.3.0" />
|
||||||
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
||||||
|
@ -23,6 +23,6 @@
|
|||||||
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2024.528.1" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2024.618.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user