mirror of
https://github.com/ppy/osu
synced 2025-04-01 22:48:33 +00:00
Fix background/track implicitly renamed on initial load
This commit is contained in:
parent
2c35b1404b
commit
f1081db953
@ -59,8 +59,10 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
if (!string.IsNullOrEmpty(working.Value.Metadata.AudioFile))
|
if (!string.IsNullOrEmpty(working.Value.Metadata.AudioFile))
|
||||||
audioTrackChooser.Current.Value = new FileInfo(working.Value.Metadata.AudioFile);
|
audioTrackChooser.Current.Value = new FileInfo(working.Value.Metadata.AudioFile);
|
||||||
|
|
||||||
backgroundChooser.Current.BindValueChanged(backgroundChanged, true);
|
backgroundChooser.Current.BindValueChanged(backgroundChanged);
|
||||||
audioTrackChooser.Current.BindValueChanged(audioTrackChanged, true);
|
audioTrackChooser.Current.BindValueChanged(audioTrackChanged);
|
||||||
|
|
||||||
|
updatePlaceholderText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ChangeBackgroundImage(FileInfo source)
|
public bool ChangeBackgroundImage(FileInfo source)
|
||||||
@ -120,29 +122,30 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void backgroundChanged(ValueChangedEvent<FileInfo> file)
|
private void backgroundChanged(ValueChangedEvent<FileInfo> file)
|
||||||
{
|
|
||||||
backgroundChooser.Text = file.NewValue == null
|
|
||||||
? "Click to select a background image"
|
|
||||||
: "Click to replace the background image";
|
|
||||||
|
|
||||||
if (file.NewValue != file.OldValue)
|
|
||||||
{
|
{
|
||||||
if (!ChangeBackgroundImage(file.NewValue))
|
if (!ChangeBackgroundImage(file.NewValue))
|
||||||
backgroundChooser.Current.Value = file.OldValue;
|
backgroundChooser.Current.Value = file.OldValue;
|
||||||
}
|
|
||||||
|
updatePlaceholderText();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void audioTrackChanged(ValueChangedEvent<FileInfo> file)
|
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 select a track"
|
||||||
: "Click to replace the track";
|
: "Click to replace the track";
|
||||||
|
|
||||||
if (file.NewValue != file.OldValue)
|
backgroundChooser.Text = backgroundChooser.Current.Value == null
|
||||||
{
|
? "Click to select a background image"
|
||||||
if (!ChangeAudioTrack(file.NewValue))
|
: "Click to replace the background image";
|
||||||
audioTrackChooser.Current.Value = file.OldValue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user