Pull up IChartDetail
.
This commit is contained in:
@@ -46,12 +46,16 @@ namespace Cryville.Crtr.Browsing.Actions {
|
||||
}
|
||||
|
||||
public IEnumerable<IResourceAction> GetActions(Type type) {
|
||||
if (type == null) return Enumerable.Empty<IResourceAction>();
|
||||
List<IResourceAction> actions;
|
||||
if (!_actions.TryGetValue(type, out actions)) {
|
||||
actions = new List<IResourceAction>();
|
||||
}
|
||||
IEnumerable<IResourceAction> result = actions;
|
||||
if (type != typeof(object)) result = result.Concat(GetActions(type.BaseType));
|
||||
if (type != typeof(object))
|
||||
result = result
|
||||
.Concat(GetActions(type.BaseType))
|
||||
.Concat(type.GetInterfaces().SelectMany(i => GetActions(i)));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@@ -5,16 +5,16 @@ using System.Collections.Generic;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace Cryville.Crtr.Browsing.Actions {
|
||||
internal class OpenConfigAction : ResourceAction<ChartDetail> {
|
||||
internal class OpenConfigAction : ResourceAction<IChartDetail> {
|
||||
public override string Name { get { return "Config"; } }
|
||||
|
||||
public override int Priority { get { return -50; } }
|
||||
|
||||
static readonly Dictionary<string, int> _rulesetTabs = new Dictionary<string, int>();
|
||||
|
||||
public override void Invoke(Uri uri, ChartDetail resource) {
|
||||
public override void Invoke(Uri uri, IChartDetail resource) {
|
||||
var master = ResourceBrowserMaster.Instance;
|
||||
var ruleset = resource.Meta.ruleset;
|
||||
var ruleset = resource.RulesetId;
|
||||
int tabId;
|
||||
if (_rulesetTabs.TryGetValue(ruleset, out tabId) && master.TryOpenTab(tabId))
|
||||
return;
|
||||
|
@@ -4,13 +4,13 @@ using System.IO;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Cryville.Crtr.Browsing.Actions {
|
||||
internal class PlayChartAction : ResourceAction<ChartDetail> {
|
||||
internal class PlayChartAction : ResourceAction<IChartDetail> {
|
||||
public override string Name { get { return "Play"; } }
|
||||
public override int Priority { get { return -100; } }
|
||||
|
||||
public override void Invoke(Uri uri, ChartDetail resource) {
|
||||
Settings.Default.LoadRuleset = Path.Combine(resource.Meta.ruleset, ".umgr");
|
||||
Settings.Default.LoadRulesetConfig = resource.Meta.ruleset + ".json";
|
||||
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);
|
||||
@@ -19,7 +19,7 @@ namespace Cryville.Crtr.Browsing.Actions {
|
||||
#endif
|
||||
Master.Instance.HideMenu();
|
||||
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
|
||||
DiscordController.Instance.SetPlaying(string.Format("{0} - {1}", resource.Meta.song.name, resource.Meta.name), resource.Meta.length);
|
||||
DiscordController.Instance.SetPlaying(string.Format("{0} - {1}", resource.SongName, resource.Name), resource.Length.TotalSeconds);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user