SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

57 lines
1.7 KiB

using System;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
namespace UnityEditor.XR.ARKit
{
internal class ARResourceGroup
{
public string name { get; set; }
public ARResourceGroup(string name)
{
this.name = name;
}
public void AddResource(ARResource resource)
{
if (resource == null)
throw new ArgumentNullException("resource");
if (m_Resources.Contains(resource))
throw new InvalidOperationException(string.Format("Duplicate resource '{0}` in group '{1}'", resource.name, name));
m_Resources.Add(resource);
}
internal void Write(string pathToAssetCatalog)
{
string path = Path.Combine(pathToAssetCatalog, name + ".arresourcegroup");
Directory.CreateDirectory(path);
// Build the contents json and write each resource to disk
var contents = new Json.ResourceGroup
{
info = new Json.AuthorInfo
{
version = 1,
author = "unity"
},
resources = new Json.Filename[m_Resources.Count]
};
for (int i = 0; i < m_Resources.Count; ++i)
{
var resource = m_Resources[i];
contents.resources[i].filename = resource.filename;
resource.Write(path);
}
// Finally, write out the json contents
File.WriteAllText(Path.Combine(path, "Contents.json"), JsonUtility.ToJson(contents));
}
List<ARResource> m_Resources = new List<ARResource>();
}
}