1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-22 11:12:55 +08:00

Set children in constructor.

This commit is contained in:
Huo Yaoyuan 2016-11-06 00:24:03 +08:00
parent 5eed07db57
commit 859a59a8ab

View File

@ -42,27 +42,8 @@ namespace osu.Game.Overlays
Anchor = Anchor.TopRight;//placeholder Anchor = Anchor.TopRight;//placeholder
Origin = Anchor.TopRight; Origin = Anchor.TopRight;
Position = new Vector2(10, 50); Position = new Vector2(10, 50);
}
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
if (database == null) database = osuGame.Beatmaps;
trackManager = osuGame.Audio.Track;
}
beatmapSource = osuGame?.Beatmap ?? new Bindable<WorkingBeatmap>();
beatmapSource.ValueChanged += workingChanged;
workingChanged();
playList = database.GetAllWithChildren<BeatmapSetInfo>();
Children = new Drawable[] Children = new Drawable[]
{ {
backgroundSprite = getScaledSprite(game.Textures.Get(@"Backgrounds/bg4")),//placeholder
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -183,6 +164,26 @@ namespace osu.Game.Overlays
}; };
} }
protected override void Load(BaseGame game)
{
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame != null)
{
if (database == null) database = osuGame.Beatmaps;
trackManager = osuGame.Audio.Track;
}
beatmapSource = osuGame?.Beatmap ?? new Bindable<WorkingBeatmap>();
beatmapSource.ValueChanged += workingChanged;
workingChanged();
playList = database.GetAllWithChildren<BeatmapSetInfo>();
backgroundSprite = getScaledSprite(game.Textures.Get(@"Backgrounds/bg4"));
AddInternal(backgroundSprite);
}
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();