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.
|
|
|
|
|
2019-10-27 14:19:36 +08:00
|
|
|
using osu.Framework.Allocation;
|
2019-11-06 13:36:43 +08:00
|
|
|
using osu.Framework.Bindables;
|
2020-09-30 16:52:12 +08:00
|
|
|
using osu.Framework.Graphics;
|
2019-10-27 14:19:36 +08:00
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2019-10-28 15:21:31 +08:00
|
|
|
using osu.Game.Graphics.UserInterfaceV2;
|
2019-10-27 14:19:36 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit.Timing
|
|
|
|
{
|
|
|
|
internal class SampleSection : Section<SampleControlPoint>
|
|
|
|
{
|
2019-10-28 15:21:31 +08:00
|
|
|
private LabelledTextBox bank;
|
2020-09-30 16:52:12 +08:00
|
|
|
private SliderWithTextBoxInput<int> volume;
|
2019-10-27 14:19:36 +08:00
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2019-10-28 15:21:31 +08:00
|
|
|
Flow.AddRange(new Drawable[]
|
2019-10-27 14:19:36 +08:00
|
|
|
{
|
2019-10-28 15:21:31 +08:00
|
|
|
bank = new LabelledTextBox
|
|
|
|
{
|
|
|
|
Label = "Bank Name",
|
|
|
|
},
|
2020-09-30 16:52:12 +08:00
|
|
|
volume = new SliderWithTextBoxInput<int>("Volume")
|
2019-10-28 15:21:31 +08:00
|
|
|
{
|
2020-09-30 16:52:12 +08:00
|
|
|
Current = new SampleControlPoint().SampleVolumeBindable,
|
2019-10-28 15:21:31 +08:00
|
|
|
}
|
2019-10-27 14:19:36 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-11-06 13:36:43 +08:00
|
|
|
protected override void OnControlPointChanged(ValueChangedEvent<SampleControlPoint> point)
|
2019-10-27 14:19:36 +08:00
|
|
|
{
|
2019-11-06 15:22:55 +08:00
|
|
|
if (point.NewValue != null)
|
|
|
|
{
|
|
|
|
bank.Current = point.NewValue.SampleBankBindable;
|
2020-10-02 16:59:47 +08:00
|
|
|
bank.Current.BindValueChanged(_ => ChangeHandler?.SaveState());
|
|
|
|
|
2020-09-30 16:52:12 +08:00
|
|
|
volume.Current = point.NewValue.SampleVolumeBindable;
|
2020-10-02 16:59:47 +08:00
|
|
|
volume.Current.BindValueChanged(_ => ChangeHandler?.SaveState());
|
2019-11-06 15:22:55 +08:00
|
|
|
}
|
2019-10-27 14:19:36 +08:00
|
|
|
}
|
2019-11-06 11:17:18 +08:00
|
|
|
|
2019-10-27 14:19:36 +08:00
|
|
|
protected override SampleControlPoint CreatePoint()
|
|
|
|
{
|
2021-01-04 15:38:15 +08:00
|
|
|
var reference = Beatmap.ControlPointInfo.SamplePointAt(SelectedGroup.Value.Time);
|
2019-10-27 14:19:36 +08:00
|
|
|
|
|
|
|
return new SampleControlPoint
|
|
|
|
{
|
|
|
|
SampleBank = reference.SampleBank,
|
|
|
|
SampleVolume = reference.SampleVolume,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
2019-10-28 11:31:38 +08:00
|
|
|
}
|