Implement legacy skin resource browser.
This commit is contained in:
22
Assets/Cryville/Crtr/Browsing/Legacy/LegacySkinDetail.cs
Normal file
22
Assets/Cryville/Crtr/Browsing/Legacy/LegacySkinDetail.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using Cryville.Crtr.Skin;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Cryville.Crtr.Browsing.Legacy {
|
||||||
|
internal class LegacySkinDetail : IResourceMeta {
|
||||||
|
public string Name { get; internal set; }
|
||||||
|
public SkinDefinition Meta { get; internal set; }
|
||||||
|
|
||||||
|
public IEnumerable<MetaProperty> Properties {
|
||||||
|
get {
|
||||||
|
if (Meta == null) {
|
||||||
|
if (Name != null)
|
||||||
|
yield return new MetaProperty("Name", Name);
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
yield return new MetaProperty("Name", Meta.name);
|
||||||
|
yield return new MetaProperty("Author", Meta.author);
|
||||||
|
yield return new MetaProperty("Ruleset", Meta.ruleset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4ddcc342c96a91942a7807625bdfd227
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -0,0 +1,27 @@
|
|||||||
|
using Cryville.Crtr.Skin;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace Cryville.Crtr.Browsing.Legacy {
|
||||||
|
internal class LegacySkinResourceManager : LegacyResourceManager<LegacySkinDetail> {
|
||||||
|
protected override string Extension { get { return ".umgs"; } }
|
||||||
|
|
||||||
|
public LegacySkinResourceManager(string rootPath) : base(rootPath) { }
|
||||||
|
|
||||||
|
protected override string GetSubRootPath(string rootPath) {
|
||||||
|
return Path.Combine(rootPath, "skins");
|
||||||
|
}
|
||||||
|
protected override LegacySkinDetail GetMeta(DirectoryInfo dir) {
|
||||||
|
SkinDefinition meta = null;
|
||||||
|
var metaFile = new FileInfo(Path.Combine(dir.FullName, Extension));
|
||||||
|
if (metaFile.Exists) {
|
||||||
|
using (var reader = new StreamReader(metaFile.FullName)) {
|
||||||
|
meta = JsonConvert.DeserializeObject<SkinDefinition>(reader.ReadToEnd());
|
||||||
|
}
|
||||||
|
return new LegacySkinDetail { Meta = meta };
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return new LegacySkinDetail { Name = dir.Name };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 323eaa68e1ba1f04498393c41a85a3ed
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -34,7 +34,8 @@ namespace Cryville.Crtr.Browsing.UI {
|
|||||||
Actions.Register(new PlayChartAction());
|
Actions.Register(new PlayChartAction());
|
||||||
Actions.Register(new OpenConfigAction());
|
Actions.Register(new OpenConfigAction());
|
||||||
|
|
||||||
OnTabClicked(AddPathedBrowserTab("Local", new LegacyResourceManager(Settings.Default.GameDataPath)));
|
OnTabClicked(AddPathedBrowserTab("Local Charts", new LegacyChartResourceManager(Settings.Default.GameDataPath)));
|
||||||
|
AddPathedBrowserTab("Local Skins", new LegacySkinResourceManager(Settings.Default.GameDataPath));
|
||||||
AddPathedBrowserTab("Files", new FileSystemResourceManager());
|
AddPathedBrowserTab("Files", new FileSystemResourceManager());
|
||||||
AddTab("Settings", InitBrowser(m_settingsBrowser), _tabs.Count, false);
|
AddTab("Settings", InitBrowser(m_settingsBrowser), _tabs.Count, false);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user