Add chart, ruleset, and skin file resource importer.
This commit is contained in:
22
Assets/Cryville/Crtr/Browsing/ChartResourceImporter.cs
Normal file
22
Assets/Cryville/Crtr/Browsing/ChartResourceImporter.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Cryville.Crtr.Browsing {
|
||||
public class ChartResourceImporter : ResourceConverter {
|
||||
static readonly string[] SUPPORTED_FORMATS = { ".umgc" };
|
||||
public override string[] GetSupportedFormats() {
|
||||
return SUPPORTED_FORMATS;
|
||||
}
|
||||
|
||||
public override IEnumerable<Resource> ConvertFrom(FileInfo file) {
|
||||
var meta = Path.Combine(file.Directory.FullName, "meta.json");
|
||||
if (!File.Exists(meta)) throw new FileNotFoundException("Meta file for the chart not found");
|
||||
using (StreamReader reader = new StreamReader(meta, Encoding.UTF8)) {
|
||||
var data = JsonConvert.DeserializeObject<ChartMeta>(reader.ReadToEnd());
|
||||
return new Resource[] { new ChartResource(data.name, file) };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Cryville/Crtr/Browsing/ChartResourceImporter.cs.meta
Normal file
11
Assets/Cryville/Crtr/Browsing/ChartResourceImporter.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 168366bb891392b42a1d0a6bfa068ff3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
20
Assets/Cryville/Crtr/Browsing/RulesetResourceImporter.cs
Normal file
20
Assets/Cryville/Crtr/Browsing/RulesetResourceImporter.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Cryville.Crtr.Browsing {
|
||||
public class RulesetResourceImporter : ResourceConverter {
|
||||
static readonly string[] SUPPORTED_FORMATS = { ".umgr" };
|
||||
public override string[] GetSupportedFormats() {
|
||||
return SUPPORTED_FORMATS;
|
||||
}
|
||||
|
||||
public override IEnumerable<Resource> ConvertFrom(FileInfo file) {
|
||||
using (StreamReader reader = new StreamReader(file.FullName, Encoding.UTF8)) {
|
||||
var data = JsonConvert.DeserializeObject<Ruleset>(reader.ReadToEnd());
|
||||
return new Resource[] { new RulesetResource(data.name, file) };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2c1531e76f19a647865f7ec335561cd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
20
Assets/Cryville/Crtr/Browsing/SkinResourceImporter.cs
Normal file
20
Assets/Cryville/Crtr/Browsing/SkinResourceImporter.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Cryville.Crtr.Browsing {
|
||||
public class SkinResourceImporter : ResourceConverter {
|
||||
static readonly string[] SUPPORTED_FORMATS = { ".umgs" };
|
||||
public override string[] GetSupportedFormats() {
|
||||
return SUPPORTED_FORMATS;
|
||||
}
|
||||
|
||||
public override IEnumerable<Resource> ConvertFrom(FileInfo file) {
|
||||
using (StreamReader reader = new StreamReader(file.FullName, Encoding.UTF8)) {
|
||||
var data = JsonConvert.DeserializeObject<Skin>(reader.ReadToEnd());
|
||||
return new Resource[] { new SkinResource(data.name, file) };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Cryville/Crtr/Browsing/SkinResourceImporter.cs.meta
Normal file
11
Assets/Cryville/Crtr/Browsing/SkinResourceImporter.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9904b4c21758c5046afc341fe2fa8845
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user