Forward internal management to a container alongside tracker

This commit is contained in:
Salman Ahmed 2021-01-19 19:03:29 +03:00
parent 4a1acdece2
commit 34612ae233
3 changed files with 18 additions and 7 deletions

View File

@ -7,6 +7,8 @@ using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Screens;
using osu.Game.Audio;
using osu.Game.Beatmaps;
@ -43,14 +45,23 @@ namespace osu.Game.Screens.OnlinePlay.Match
[Cached]
protected readonly MultiplayerBeatmapTracker BeatmapTracker;
private readonly Container content = new Container { RelativeSizeAxes = Axes.Both };
protected RoomSubScreen()
{
InternalChild = BeatmapTracker = new MultiplayerBeatmapTracker
base.AddInternal(BeatmapTracker = new MultiplayerBeatmapTracker
{
SelectedItem = { BindTarget = SelectedItem },
};
SelectedItem = { BindTarget = SelectedItem }
});
base.AddInternal(content);
}
// 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 bool RemoveInternal(Drawable drawable) => content.Remove(drawable);
protected override void ClearInternal(bool disposeChildren = true) => content.Clear(disposeChildren);
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{

View File

@ -53,7 +53,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
[BackgroundDependencyLoader]
private void load()
{
AddRangeInternal(new Drawable[]
InternalChildren = new Drawable[]
{
new GridContainer
{
@ -176,7 +176,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
RelativeSizeAxes = Axes.Both,
State = { Value = client.Room == null ? Visibility.Visible : Visibility.Hidden }
}
});
};
}
protected override void LoadComplete()

View File

@ -42,7 +42,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
[BackgroundDependencyLoader]
private void load()
{
AddRangeInternal(new Drawable[]
InternalChildren = new Drawable[]
{
new GridContainer
{
@ -188,7 +188,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
EditPlaylist = () => this.Push(new MatchSongSelect()),
State = { Value = roomId.Value == null ? Visibility.Visible : Visibility.Hidden }
}
});
};
}
[Resolved]