1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-31 17:52:54 +08:00

Remove dependency on SamplesBindable

This commit is contained in:
OliBomby 2023-05-08 11:54:33 +02:00
parent e69152fd14
commit 244ca4e8c7

View File

@ -26,12 +26,12 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
public readonly HitObject HitObject;
private readonly BindableList<HitSampleInfo> samplesBindable;
[Resolved(canBeNull: true)]
private EditorBeatmap editorBeatmap { get; set; } = null!;
public SamplePointPiece(HitObject hitObject)
{
HitObject = hitObject;
samplesBindable = hitObject.SamplesBindable.GetBoundCopy();
}
protected override Color4 GetRepresentingColour(OsuColour colours) => colours.Pink;
@ -39,7 +39,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
[BackgroundDependencyLoader]
private void load()
{
samplesBindable.BindCollectionChanged((_, _) => updateText(), true);
HitObject.DefaultsApplied += _ => updateText();
updateText();
}
protected override bool OnClick(ClickEvent e)
@ -50,7 +51,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
private void updateText()
{
Label.Text = $"{GetBankValue(samplesBindable)} {GetVolumeValue(samplesBindable)}";
Label.Text = $"{GetBankValue(HitObject.Samples)} {GetVolumeValue(HitObject.Samples)}";
}
public static string? GetBankValue(IEnumerable<HitSampleInfo> samples)