1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:07:25 +08:00

No longer holds OsuGame reference.

This commit is contained in:
Huo Yaoyuan 2016-10-28 20:47:14 +08:00
parent 9b76110605
commit 3858c77817

View File

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework;
@ -15,7 +14,6 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics.Transformations;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.IO;
using osu.Game.Database;
using osu.Game.Graphics;
@ -28,7 +26,6 @@ namespace osu.Game.Overlays
private TextAwesome playButton, listButton;
private SpriteText title, artist;
private OsuGameBase osuGame;
private TrackManager trackManager;
private List<BeatmapSetInfo> playList;
private BeatmapDatabase database;
@ -43,13 +40,17 @@ namespace osu.Game.Overlays
public override void Load(BaseGame game)
{
base.Load(game);
osuGame = game as OsuGameBase;
var osuGame = game as OsuGameBase;
beatmapSource = osuGame.Beatmap ?? new Bindable<WorkingBeatmap>();
beatmapSource.ValueChanged += workingChanged;
workingChanged();
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>();
Width = 400;