1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-17 20:07:26 +08:00

Fix background/track implicitly renamed on initial load

This commit is contained in:
Salman Ahmed 2022-06-16 18:48:32 +03:00
parent 2c35b1404b
commit f1081db953

View File

@ -59,8 +59,10 @@ namespace osu.Game.Screens.Edit.Setup
if (!string.IsNullOrEmpty(working.Value.Metadata.AudioFile))
audioTrackChooser.Current.Value = new FileInfo(working.Value.Metadata.AudioFile);
backgroundChooser.Current.BindValueChanged(backgroundChanged, true);
audioTrackChooser.Current.BindValueChanged(audioTrackChanged, true);
backgroundChooser.Current.BindValueChanged(backgroundChanged);
audioTrackChooser.Current.BindValueChanged(audioTrackChanged);
updatePlaceholderText();
}
public bool ChangeBackgroundImage(FileInfo source)
@ -121,28 +123,29 @@ namespace osu.Game.Screens.Edit.Setup
private void backgroundChanged(ValueChangedEvent<FileInfo> file)
{
backgroundChooser.Text = file.NewValue == null
? "Click to select a background image"
: "Click to replace the background image";
if (!ChangeBackgroundImage(file.NewValue))
backgroundChooser.Current.Value = file.OldValue;
if (file.NewValue != file.OldValue)
{
if (!ChangeBackgroundImage(file.NewValue))
backgroundChooser.Current.Value = file.OldValue;
}
updatePlaceholderText();
}
private void audioTrackChanged(ValueChangedEvent<FileInfo> file)
{
audioTrackChooser.Text = file.NewValue == null
if (!ChangeAudioTrack(file.NewValue))
audioTrackChooser.Current.Value = file.OldValue;
updatePlaceholderText();
}
private void updatePlaceholderText()
{
audioTrackChooser.Text = audioTrackChooser.Current.Value == null
? "Click to select a track"
: "Click to replace the track";
if (file.NewValue != file.OldValue)
{
if (!ChangeAudioTrack(file.NewValue))
audioTrackChooser.Current.Value = file.OldValue;
}
backgroundChooser.Text = backgroundChooser.Current.Value == null
? "Click to select a background image"
: "Click to replace the background image";
}
}
}