mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -146,10 +145,15 @@ namespace osu.Game.Tournament.Components
|
|||||||
|
|
||||||
private void matchChanged(ValueChangedEvent<MatchPairing> pairing)
|
private void matchChanged(ValueChangedEvent<MatchPairing> pairing)
|
||||||
{
|
{
|
||||||
|
if (pairing.OldValue != null)
|
||||||
|
pairing.OldValue.PicksBans.CollectionChanged -= picksBansOnCollectionChanged;
|
||||||
pairing.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged;
|
pairing.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged;
|
||||||
updateState();
|
updateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void picksBansOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||||
|
=> updateState();
|
||||||
|
|
||||||
private BeatmapChoice choice;
|
private BeatmapChoice choice;
|
||||||
|
|
||||||
private void updateState()
|
private void updateState()
|
||||||
@ -197,19 +201,5 @@ namespace osu.Game.Tournament.Components
|
|||||||
Alpha = 1;
|
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