Replay loading via drag-drop huzzah!

This commit is contained in:
Dean Herbert
2017-03-04 19:02:36 +09:00
parent a8deb4ff50
commit 95e2e2b027
15 changed files with 536 additions and 328 deletions

View File

@ -24,9 +24,10 @@ using osu.Game.Screens.Menu;
using OpenTK;
using System.Linq;
using osu.Framework.Graphics.Primitives;
using System.Collections.Generic;
using System.Threading.Tasks;
using osu.Game.Graphics;
using osu.Game.Overlays.Notifications;
using osu.Game.Screens.Play;
namespace osu.Game
{
@ -92,6 +93,39 @@ namespace osu.Game
PlayMode = LocalConfig.GetBindable<PlayMode>(OsuConfig.PlayMode);
}
protected void LoadScore(Score s)
{
var menu = intro.ChildScreen;
if (menu == null)
{
Schedule(() => LoadScore(s));
return;
}
if (!menu.IsCurrentScreen)
{
menu.MakeCurrent();
Delay(500);
Schedule(() => LoadScore(s));
return;
}
if (s.Beatmap == null)
{
notificationManager.Post(new SimpleNotification
{
Text = @"Tried to load a score for a beatmap we don't have!",
Icon = FontAwesome.fa_life_saver,
});
return;
}
Beatmap.Value = BeatmapDatabase.GetWorkingBeatmap(s.Beatmap);
menu.Push(new PlayerLoader(new Player { ReplayInputHandler = s.Replay.GetInputHandler() }));
}
protected override void LoadComplete()
{
base.LoadComplete();