mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Make use of ValueChanged.OldValue
This commit is contained in:
parent
f81c66db63
commit
d8ed402779
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
@ -146,10 +145,15 @@ namespace osu.Game.Tournament.Components
|
||||
|
||||
private void matchChanged(ValueChangedEvent<MatchPairing> pairing)
|
||||
{
|
||||
if (pairing.OldValue != null)
|
||||
pairing.OldValue.PicksBans.CollectionChanged -= picksBansOnCollectionChanged;
|
||||
pairing.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged;
|
||||
updateState();
|
||||
}
|
||||
|
||||
private void picksBansOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
=> updateState();
|
||||
|
||||
private BeatmapChoice choice;
|
||||
|
||||
private void updateState()
|
||||
@ -197,19 +201,5 @@ namespace osu.Game.Tournament.Components
|
||||
Alpha = 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void picksBansOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
var list = (ObservableCollection<BeatmapChoice>)sender;
|
||||
|
||||
if (sender != currentMatch.Value.PicksBans)
|
||||
{
|
||||
// todo: we need a last attribute in bindable valuechanged events badly.
|
||||
list.CollectionChanged -= picksBansOnCollectionChanged;
|
||||
return;
|
||||
}
|
||||
|
||||
updateState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user