Pull down IPathedResourceManager
. Reconstruct resource browser.
This commit is contained in:
@@ -13,14 +13,17 @@ using UnityEngine;
|
||||
using Logger = Cryville.Common.Logging.Logger;
|
||||
|
||||
namespace Cryville.Crtr.Browsing {
|
||||
internal class LegacyResourceManager : IResourceManager<ChartDetail> {
|
||||
internal class LegacyResourceManager : IPathedResourceManager<ChartDetail> {
|
||||
private readonly string _rootPath;
|
||||
private DirectoryInfo cd;
|
||||
private DirectoryInfo[] items = new DirectoryInfo[0];
|
||||
public string[] CurrentDirectory { get; private set; }
|
||||
public int ItemCount { get { return items.Length; } }
|
||||
|
||||
static bool _init;
|
||||
|
||||
public event Action ItemChanged;
|
||||
|
||||
public LegacyResourceManager(string rootPath) {
|
||||
_rootPath = rootPath;
|
||||
if (!_init) {
|
||||
@@ -29,24 +32,24 @@ namespace Cryville.Crtr.Browsing {
|
||||
}
|
||||
}
|
||||
|
||||
public int ChangeDirectory(string[] dir) {
|
||||
public void ChangeDirectory(string[] dir) {
|
||||
CurrentDirectory = dir;
|
||||
cd = new DirectoryInfo(_rootPath + "/charts/" + string.Join("/", dir));
|
||||
items = cd.GetDirectories();
|
||||
return items.Length;
|
||||
ItemChanged?.Invoke();
|
||||
}
|
||||
|
||||
public int OpenDirectory(int id) {
|
||||
public void OpenDirectory(int id) {
|
||||
string[] nd = new string[CurrentDirectory.Length + 1];
|
||||
Array.Copy(CurrentDirectory, nd, CurrentDirectory.Length);
|
||||
nd[CurrentDirectory.Length] = items[id].Name;
|
||||
return ChangeDirectory(nd);
|
||||
ChangeDirectory(nd);
|
||||
}
|
||||
|
||||
public int ReturnToDirectory(int id) {
|
||||
public void ReturnToDirectory(int id) {
|
||||
string[] nd = new string[id + 1];
|
||||
Array.Copy(CurrentDirectory, nd, id + 1);
|
||||
return ChangeDirectory(nd);
|
||||
ChangeDirectory(nd);
|
||||
}
|
||||
|
||||
public ResourceItemMeta GetItemMeta(int id) {
|
||||
|
Reference in New Issue
Block a user