diff --git a/Assets/Cryville/Crtr/Browsing/UI/PathedResourceBrowser.cs b/Assets/Cryville/Crtr/Browsing/UI/PathedResourceBrowser.cs index 6f21e79..b769710 100644 --- a/Assets/Cryville/Crtr/Browsing/UI/PathedResourceBrowser.cs +++ b/Assets/Cryville/Crtr/Browsing/UI/PathedResourceBrowser.cs @@ -1,5 +1,6 @@ using Cryville.Common.Unity; using Cryville.Common.Unity.UI; +using Cryville.Crtr.Browsing.Actions; using Cryville.Crtr.UI; using System; using System.Collections.Generic; @@ -19,6 +20,7 @@ namespace Cryville.Crtr.Browsing.UI { GameObject m_actionBar; IPathedResourceManager _manager; + IResourceAction _importAction; readonly HashSet _selectedItems = new HashSet(); readonly Dictionary _items = new Dictionary(); @@ -34,6 +36,7 @@ namespace Cryville.Crtr.Browsing.UI { UnregisterManager(); } void UnregisterManager() { + Master.Actions.Unregister(_importAction); _manager.ItemChanged -= OnItemChanged; _manager.DirectoryChanged -= OnDirectoryChanged; } @@ -53,6 +56,7 @@ namespace Cryville.Crtr.Browsing.UI { _manager = manager; _manager.ItemChanged += OnItemChanged; _manager.DirectoryChanged += OnDirectoryChanged; + Master.Actions.Register(_importAction = new ImportResourceAction(_manager)); OnItemChanged(); OnDirectoryChanged(); diff --git a/Assets/Cryville/Crtr/Browsing/UI/ResourceBrowserMaster.cs b/Assets/Cryville/Crtr/Browsing/UI/ResourceBrowserMaster.cs index a689fc8..7061685 100644 --- a/Assets/Cryville/Crtr/Browsing/UI/ResourceBrowserMaster.cs +++ b/Assets/Cryville/Crtr/Browsing/UI/ResourceBrowserMaster.cs @@ -1,9 +1,7 @@ +using Cryville.Crtr.Browsing.Actions; using Cryville.Crtr.Config.UI; -using Cryville.Crtr.UI; using System.Collections.Generic; -using System.IO; using UnityEngine; -using UnityEngine.SceneManagement; namespace Cryville.Crtr.Browsing.UI { public class ResourceBrowserMaster : MonoBehaviour { @@ -21,8 +19,12 @@ namespace Cryville.Crtr.Browsing.UI { BrowserTab _currentTab; readonly Dictionary _tabs = new Dictionary(); + public ActionManager Actions { get; private set; } + void Awake() { - m_mainBrowser.ResourceManager = new LegacyResourceManager(Settings.Default.GameDataPath); + Actions = new ActionManager(); + Actions.Register(new PlayChartAction()); + OnTabClicked(AddTab("Local", m_mainBrowser)); m_mainBrowser.Init(this, new LegacyResourceManager(Settings.Default.GameDataPath)); @@ -54,28 +56,5 @@ namespace Cryville.Crtr.Browsing.UI { public bool Back() { return true; // TODO } - - public void Open(int id, ChartDetail detail) { - SetDataSettings(id, detail); -#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}", detail.Meta.song.name, detail.Meta.name), detail.Meta.length); -#endif - } - - public void OpenConfig(int id, ChartDetail detail) { - SetDataSettings(id, detail); - } - - void SetDataSettings(int id, ChartDetail detail) { - Settings.Default.LoadRuleset = Path.Combine(detail.Meta.ruleset, ".umgr"); - Settings.Default.LoadRulesetConfig = detail.Meta.ruleset + ".json"; - Settings.Default.LoadChart = m_mainBrowser.ResourceManager.GetItemUri(id).LocalPath; - } } }