1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:07:52 +08:00

Replace all usage of IBindableList.GetBoundCopy

This commit is contained in:
Dean Herbert 2020-11-04 15:29:14 +09:00
parent 9343f84a68
commit 487a5ecdba
8 changed files with 18 additions and 19 deletions

View File

@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Taiko.Audio
private readonly ControlPointInfo controlPoints;
private readonly Dictionary<double, DrumSample> mappings = new Dictionary<double, DrumSample>();
private IBindableList<SampleControlPoint> samplePoints;
private readonly IBindableList<SampleControlPoint> samplePoints = new BindableList<SampleControlPoint>();
public DrumSampleContainer(ControlPointInfo controlPoints)
{
@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Taiko.Audio
[BackgroundDependencyLoader]
private void load()
{
samplePoints = controlPoints.SamplePoints.GetBoundCopy();
samplePoints.BindTo(controlPoints.SamplePoints);
samplePoints.BindCollectionChanged((_, __) => recreateMappings(), true);
}

View File

@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Dashboard
{
internal class CurrentlyPlayingDisplay : CompositeDrawable
{
private IBindableList<int> playingUsers;
private readonly IBindableList<int> playingUsers = new BindableList<int>();
private FillFlowContainer<PlayingUserPanel> userFlow;
@ -48,7 +48,7 @@ namespace osu.Game.Overlays.Dashboard
{
base.LoadComplete();
playingUsers = spectatorStreaming.PlayingUsers.GetBoundCopy();
playingUsers.BindTo(spectatorStreaming.PlayingUsers);
playingUsers.BindCollectionChanged((sender, e) => Schedule(() =>
{
switch (e.Action)

View File

@ -14,13 +14,13 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
/// </summary>
public class ControlPointPart : TimelinePart<GroupVisualisation>
{
private IBindableList<ControlPointGroup> controlPointGroups;
private readonly IBindableList<ControlPointGroup> controlPointGroups = new BindableList<ControlPointGroup>();
protected override void LoadBeatmap(WorkingBeatmap beatmap)
{
base.LoadBeatmap(beatmap);
controlPointGroups = beatmap.Beatmap.ControlPointInfo.Groups.GetBoundCopy();
controlPointGroups.BindTo(beatmap.Beatmap.ControlPointInfo.Groups);
controlPointGroups.BindCollectionChanged((sender, args) =>
{
switch (args.Action)

View File

@ -15,7 +15,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
{
public readonly ControlPointGroup Group;
private BindableList<ControlPoint> controlPoints;
private readonly IBindableList<ControlPoint> controlPoints = new BindableList<ControlPoint>();
[Resolved]
private OsuColour colours { get; set; }
@ -30,7 +30,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
{
base.LoadComplete();
controlPoints = (BindableList<ControlPoint>)Group.ControlPoints.GetBoundCopy();
controlPoints.BindTo(Group.ControlPoints);
controlPoints.BindCollectionChanged((_, __) =>
{
if (controlPoints.Count == 0)

View File

@ -16,7 +16,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
/// </summary>
public class TimelineControlPointDisplay : TimelinePart<TimelineControlPointGroup>
{
private IBindableList<ControlPointGroup> controlPointGroups;
private readonly IBindableList<ControlPointGroup> controlPointGroups = new BindableList<ControlPointGroup>();
public TimelineControlPointDisplay()
{
@ -27,7 +27,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
base.LoadBeatmap(beatmap);
controlPointGroups = beatmap.Beatmap.ControlPointInfo.Groups.GetBoundCopy();
controlPointGroups.BindTo(beatmap.Beatmap.ControlPointInfo.Groups);
controlPointGroups.BindCollectionChanged((sender, args) =>
{
switch (args.Action)

View File

@ -14,7 +14,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
public readonly ControlPointGroup Group;
private BindableList<ControlPoint> controlPoints;
private readonly IBindableList<ControlPoint> controlPoints = new BindableList<ControlPoint>();
[Resolved]
private OsuColour colours { get; set; }
@ -34,7 +34,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
base.LoadComplete();
controlPoints = (BindableList<ControlPoint>)Group.ControlPoints.GetBoundCopy();
controlPoints.BindTo(Group.ControlPoints);
controlPoints.BindCollectionChanged((_, __) =>
{
ClearInternal();

View File

@ -98,7 +98,7 @@ namespace osu.Game.Screens.Edit.Timing
private class ControlGroupAttributes : CompositeDrawable
{
private readonly IBindableList<ControlPoint> controlPoints;
private readonly IBindableList<ControlPoint> controlPoints = new BindableList<ControlPoint>();
private readonly FillFlowContainer fill;
@ -112,7 +112,7 @@ namespace osu.Game.Screens.Edit.Timing
Spacing = new Vector2(2)
};
controlPoints = group.ControlPoints.GetBoundCopy();
controlPoints.BindTo(group.ControlPoints);
}
[Resolved]

View File

@ -56,7 +56,7 @@ namespace osu.Game.Screens.Edit.Timing
private OsuButton deleteButton;
private ControlPointTable table;
private IBindableList<ControlPointGroup> controlGroups;
private readonly IBindableList<ControlPointGroup> controlPointGroups = new BindableList<ControlPointGroup>();
[Resolved]
private EditorClock clock { get; set; }
@ -124,11 +124,10 @@ namespace osu.Game.Screens.Edit.Timing
selectedGroup.BindValueChanged(selected => { deleteButton.Enabled.Value = selected.NewValue != null; }, true);
controlGroups = Beatmap.Value.Beatmap.ControlPointInfo.Groups.GetBoundCopy();
controlGroups.BindCollectionChanged((sender, args) =>
controlPointGroups.BindTo(Beatmap.Value.Beatmap.ControlPointInfo.Groups);
controlPointGroups.BindCollectionChanged((sender, args) =>
{
table.ControlGroups = controlGroups;
table.ControlGroups = controlPointGroups;
changeHandler.SaveState();
}, true);
}