Merge pull request #18530 from peppy/add-cloen-button

Change text on timing group add button when it is going to clone instead
This commit is contained in:
Dan Balasescu 2022-06-03 22:23:04 +09:00 committed by GitHub
commit fcf51a6f51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 3 deletions

View File

@ -53,6 +53,8 @@ public class ControlPointList : CompositeDrawable
private readonly IBindableList<ControlPointGroup> controlPointGroups = new BindableList<ControlPointGroup>();
private RoundedButton addButton;
[Resolved]
private EditorClock clock { get; set; }
@ -107,9 +109,8 @@ private void load(OverlayColourProvider colours)
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
},
new RoundedButton
addButton = new RoundedButton
{
Text = "+ Add at current time",
Action = addNew,
Size = new Vector2(160, 30),
Anchor = Anchor.BottomRight,
@ -124,7 +125,14 @@ protected override void LoadComplete()
{
base.LoadComplete();
selectedGroup.BindValueChanged(selected => { deleteButton.Enabled.Value = selected.NewValue != null; }, true);
selectedGroup.BindValueChanged(selected =>
{
deleteButton.Enabled.Value = selected.NewValue != null;
addButton.Text = selected.NewValue != null
? "+ Clone to current time"
: "+ Add at current time";
}, true);
controlPointGroups.BindTo(Beatmap.ControlPointInfo.Groups);
controlPointGroups.BindCollectionChanged((sender, args) =>
@ -145,6 +153,8 @@ protected override void Update()
base.Update();
trackActivePoint();
addButton.Enabled.Value = clock.CurrentTimeAccurate != selectedGroup.Value?.Time;
}
private Type trackedType;