1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-28 08:43:06 +08:00
osu-lazer/osu.Game/Screens/Edit/Timing/SampleSection.cs

57 lines
1.8 KiB
C#
Raw Normal View History

2019-10-28 11:42:17 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.UserInterfaceV2;
namespace osu.Game.Screens.Edit.Timing
{
internal class SampleSection : Section<SampleControlPoint>
{
private LabelledTextBox bank;
private SliderWithTextBoxInput<int> volume;
[BackgroundDependencyLoader]
private void load()
{
Flow.AddRange(new Drawable[]
{
bank = new LabelledTextBox
{
Label = "Bank Name",
},
volume = new SliderWithTextBoxInput<int>("Volume")
{
Current = new SampleControlPoint().SampleVolumeBindable,
}
});
}
protected override void OnControlPointChanged(ValueChangedEvent<SampleControlPoint> point)
{
if (point.NewValue != null)
{
bank.Current = point.NewValue.SampleBankBindable;
2020-10-02 16:59:47 +08:00
bank.Current.BindValueChanged(_ => ChangeHandler?.SaveState());
volume.Current = point.NewValue.SampleVolumeBindable;
2020-10-02 16:59:47 +08:00
volume.Current.BindValueChanged(_ => ChangeHandler?.SaveState());
}
}
2019-11-06 11:17:18 +08:00
protected override SampleControlPoint CreatePoint()
{
var reference = Beatmap.ControlPointInfo.SamplePointAt(SelectedGroup.Value.Time);
return new SampleControlPoint
{
SampleBank = reference.SampleBank,
SampleVolume = reference.SampleVolume,
};
}
}
2019-10-28 11:31:38 +08:00
}