Refactor content redirection logic to be easier to parse

This commit is contained in:
Dean Herbert 2021-02-05 14:25:19 +09:00
parent 78ea2d50bb
commit fc37d8b7df

View File

@ -45,18 +45,21 @@ namespace osu.Game.Screens.OnlinePlay.Match
[Cached] [Cached]
protected OnlinePlayBeatmapAvailablilityTracker BeatmapAvailablilityTracker { get; } protected OnlinePlayBeatmapAvailablilityTracker BeatmapAvailablilityTracker { get; }
private readonly Container content = new Container { RelativeSizeAxes = Axes.Both }; private readonly Container content;
protected RoomSubScreen() protected RoomSubScreen()
{ {
BeatmapAvailablilityTracker = new OnlinePlayBeatmapAvailablilityTracker InternalChildren = new Drawable[]
{ {
SelectedItem = { BindTarget = SelectedItem } BeatmapAvailablilityTracker = new OnlinePlayBeatmapAvailablilityTracker
{
SelectedItem = { BindTarget = SelectedItem }
},
content = new Container { RelativeSizeAxes = Axes.Both },
}; };
base.AddInternal(content);
} }
// Forward all internal management to content to ensure locally added components are not removed unintentionally.
// This is a bit ugly but we don't have the concept of InternalContent so it'll have to do for now. (https://github.com/ppy/osu-framework/issues/1690) // This is a bit ugly but we don't have the concept of InternalContent so it'll have to do for now. (https://github.com/ppy/osu-framework/issues/1690)
protected override void AddInternal(Drawable drawable) => content.Add(drawable); protected override void AddInternal(Drawable drawable) => content.Add(drawable);
protected override bool RemoveInternal(Drawable drawable) => content.Remove(drawable); protected override bool RemoveInternal(Drawable drawable) => content.Remove(drawable);
@ -65,8 +68,6 @@ namespace osu.Game.Screens.OnlinePlay.Match
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load(AudioManager audio)
{ {
base.AddInternal(BeatmapAvailablilityTracker);
sampleStart = audio.Samples.Get(@"SongSelect/confirm-selection"); sampleStart = audio.Samples.Get(@"SongSelect/confirm-selection");
} }