1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 17:32:54 +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 ControlPointInfo controlPoints;
private readonly Dictionary<double, DrumSample> mappings = new Dictionary<double, DrumSample>(); 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) public DrumSampleContainer(ControlPointInfo controlPoints)
{ {
@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Taiko.Audio
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
samplePoints = controlPoints.SamplePoints.GetBoundCopy(); samplePoints.BindTo(controlPoints.SamplePoints);
samplePoints.BindCollectionChanged((_, __) => recreateMappings(), true); samplePoints.BindCollectionChanged((_, __) => recreateMappings(), true);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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