mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 20:12:56 +08:00
Rewrite bindable flow to make more sense
This commit is contained in:
parent
32b34c1967
commit
4a1401a33d
@ -40,13 +40,7 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
protected override FileChooserPopover CreatePopover(string[] handledExtensions, Bindable<FileInfo?> current, string? chooserPath)
|
protected override FileChooserPopover CreatePopover(string[] handledExtensions, Bindable<FileInfo?> current, string? chooserPath)
|
||||||
{
|
{
|
||||||
var popover = new BeatmapFileChooserPopover(handledExtensions, current, chooserPath, beatmapHasMultipleDifficulties);
|
var popover = new BeatmapFileChooserPopover(handledExtensions, current, chooserPath, beatmapHasMultipleDifficulties);
|
||||||
|
popover.ApplyToAllDifficulties.BindTo(ApplyToAllDifficulties);
|
||||||
popover.ApplyToAllDifficulties.ValueChanged += v =>
|
|
||||||
{
|
|
||||||
Debug.Assert(v.NewValue != null);
|
|
||||||
ApplyToAllDifficulties.Value = v.NewValue.Value;
|
|
||||||
};
|
|
||||||
|
|
||||||
return popover;
|
return popover;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +48,7 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
{
|
{
|
||||||
private readonly bool beatmapHasMultipleDifficulties;
|
private readonly bool beatmapHasMultipleDifficulties;
|
||||||
|
|
||||||
public readonly Bindable<bool?> ApplyToAllDifficulties = new Bindable<bool?>();
|
public readonly Bindable<bool> ApplyToAllDifficulties = new Bindable<bool>(true);
|
||||||
|
|
||||||
private Container selectApplicationScopeContainer = null!;
|
private Container selectApplicationScopeContainer = null!;
|
||||||
|
|
||||||
@ -115,7 +109,11 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Width = 300f,
|
Width = 300f,
|
||||||
Text = "Apply to all difficulties",
|
Text = "Apply to all difficulties",
|
||||||
Action = () => ApplyToAllDifficulties.Value = true,
|
Action = () =>
|
||||||
|
{
|
||||||
|
ApplyToAllDifficulties.Value = true;
|
||||||
|
updateFileSelection();
|
||||||
|
},
|
||||||
BackgroundColour = colours.Red2,
|
BackgroundColour = colours.Red2,
|
||||||
},
|
},
|
||||||
new RoundedButton
|
new RoundedButton
|
||||||
@ -124,7 +122,11 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Width = 300f,
|
Width = 300f,
|
||||||
Text = "Only apply to this difficulty",
|
Text = "Only apply to this difficulty",
|
||||||
Action = () => ApplyToAllDifficulties.Value = false,
|
Action = () =>
|
||||||
|
{
|
||||||
|
ApplyToAllDifficulties.Value = false;
|
||||||
|
updateFileSelection();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,12 +136,6 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
ApplyToAllDifficulties.ValueChanged += onChangeScopeSelected;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnFileSelected(FileInfo file)
|
protected override void OnFileSelected(FileInfo file)
|
||||||
{
|
{
|
||||||
if (beatmapHasMultipleDifficulties)
|
if (beatmapHasMultipleDifficulties)
|
||||||
@ -148,11 +144,8 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
base.OnFileSelected(file);
|
base.OnFileSelected(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onChangeScopeSelected(ValueChangedEvent<bool?> c)
|
private void updateFileSelection()
|
||||||
{
|
{
|
||||||
if (c.NewValue == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Debug.Assert(FileSelector.CurrentFile.Value != null);
|
Debug.Assert(FileSelector.CurrentFile.Value != null);
|
||||||
base.OnFileSelected(FileSelector.CurrentFile.Value);
|
base.OnFileSelected(FileSelector.CurrentFile.Value);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user