mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 18:52:55 +08:00
Rename OnSourceChanged
and expand on xmldoc to mention that it doesn't fire SourceChanged
This commit is contained in:
parent
a849e7343e
commit
d7cbacc5a0
@ -64,7 +64,7 @@ namespace osu.Game.Tests.Skins
|
||||
|
||||
public new void TriggerSourceChanged() => base.TriggerSourceChanged();
|
||||
|
||||
protected override void OnSourceChanged()
|
||||
protected override void RefreshSources()
|
||||
{
|
||||
SetSources(sources);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Skinning
|
||||
return base.CreateChildDependencies(parent);
|
||||
}
|
||||
|
||||
protected override void OnSourceChanged()
|
||||
protected override void RefreshSources()
|
||||
{
|
||||
// Populate a local list first so we can adjust the returned order as we go.
|
||||
var sources = new List<ISkin>();
|
||||
|
@ -173,6 +173,9 @@ namespace osu.Game.Skinning
|
||||
/// <summary>
|
||||
/// Replace the sources used for lookups in this container.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This does not implicitly fire a <see cref="SourceChanged"/> event. Consider calling <see cref="TriggerSourceChanged"/> if required.
|
||||
/// </remarks>
|
||||
/// <param name="sources">The new sources.</param>
|
||||
protected void SetSources(IEnumerable<ISkin> sources)
|
||||
{
|
||||
@ -195,15 +198,15 @@ namespace osu.Game.Skinning
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when any source has changed (either <see cref="ParentSource"/> or sources replaced via <see cref="SetSources"/>).
|
||||
/// Invoked after any consumed source change, before the external <see cref="SourceChanged"/> event is fired.
|
||||
/// This is also invoked once initially during <see cref="CreateChildDependencies"/> to ensure sources are ready for children consumption.
|
||||
/// </summary>
|
||||
protected virtual void OnSourceChanged() { }
|
||||
protected virtual void RefreshSources() { }
|
||||
|
||||
protected void TriggerSourceChanged()
|
||||
{
|
||||
// Expose to implementations, giving them a chance to react before notifying external consumers.
|
||||
OnSourceChanged();
|
||||
RefreshSources();
|
||||
|
||||
SourceChanged?.Invoke();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user