Implement ruleset config browser.
This commit is contained in:
26
Assets/Cryville/Crtr/Browsing/Actions/OpenConfigAction.cs
Normal file
26
Assets/Cryville/Crtr/Browsing/Actions/OpenConfigAction.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Cryville.Crtr.Browsing.UI;
|
||||
using Cryville.Crtr.UI;
|
||||
using System;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace Cryville.Crtr.Browsing.Actions {
|
||||
internal class OpenConfigAction : ResourceAction<ChartDetail> {
|
||||
public override string Name { get { return "Config"; } }
|
||||
|
||||
public override int Priority { get { return -50; } }
|
||||
|
||||
public override void Invoke(Uri uri, ChartDetail resource) {
|
||||
var master = ResourceBrowserMaster.Instance;
|
||||
var browser = Object.Instantiate(master.m_configBrowserPrefab).GetComponent<RulesetConfigBrowser>();
|
||||
try {
|
||||
browser.Load(resource.Meta.ruleset);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Dialog.Show(null, ex.Message);
|
||||
Game.MainLogger.Log(4, "Config", "An error occurred while loading the config: {0}", ex);
|
||||
return;
|
||||
}
|
||||
master.AddAndOpenTab(string.Format("Config: {0}", resource.Meta.ruleset), browser);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cf0a29d123b05b4eb8dcc415c235a10
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user