using Cryville.Crtr.UI; using System; using System.IO; using UnityEngine.SceneManagement; namespace Cryville.Crtr.Browsing.Actions { internal class PlayChartAction : ResourceAction { public override string Name { get { return "Play"; } } public override int Priority { get { return -100; } } public override bool CanInvoke(Uri uri, IChartDetail resource) { return true; } public override void Invoke(Uri uri, IChartDetail resource) { Settings.Default.LoadRuleset = Path.Combine(resource.RulesetId, ".umgr"); Settings.Default.LoadRulesetConfig = resource.RulesetId + ".json"; Settings.Default.LoadChart = uri.LocalPath; #if UNITY_5_3_OR_NEWER SceneManager.LoadScene("Play", LoadSceneMode.Additive); #else Application.LoadLevelAdditive("Play"); #endif Master.Instance.HideMenu(); #if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN DiscordController.Instance.SetPlaying(string.Format("{0} - {1}", resource.SongName, resource.Name), resource.Length.TotalSeconds); #endif } } }