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

View File

@ -53,6 +53,8 @@ namespace osu.Game.Screens.Edit.Timing
private readonly IBindableList<ControlPointGroup> controlPointGroups = new BindableList<ControlPointGroup>();
private RoundedButton addButton;
[Resolved]
private EditorClock clock { get; set; }
@ -107,9 +109,8 @@ namespace osu.Game.Screens.Edit.Timing
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 @@ namespace osu.Game.Screens.Edit.Timing
{
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 @@ namespace osu.Game.Screens.Edit.Timing
base.Update();
trackActivePoint();
addButton.Enabled.Value = clock.CurrentTimeAccurate != selectedGroup.Value?.Time;
}
private Type trackedType;