Exemplo n.º 1
0
        public static string CreateSourcePath(ContentHandle handle)
        {
            if (handle == null || !handle.IsValid())
            {
                Debug.LogError("[ContentFileLoader] Error! Cannot create file source path from null or invalid content handle!");
                return(string.Empty);
            }

            string rootPath         = ProjectManager.ActiveProject?.rootPath ?? string.Empty;
            string subPath          = ContentHelper.GetContentCategorySubPath(handle.category);
            string contentDirectory = Path.Combine(rootPath, subPath);

            FileFormat fileFormat    = ProjectManager.ActiveProject.preferredFileFormat;
            string     fileExtension = (from ext in fileExtensions where ext.format == fileFormat select ext.extension).FirstOrDefault();
            string     fileName      = $"{handle.nameKey}{fileExtension ?? string.Empty}";

            return(Path.Combine(contentDirectory, fileName));
        }
Exemplo n.º 2
0
 public Type GetContentType()
 {
     return(ContentHelper.GetContentType(contentType) ?? customType);
 }
Exemplo n.º 3
0
 public Type GetValueType(ContentType contentType = ContentType.Unknown)
 {
     return(content != null?content.GetType() : ContentHelper.GetContentType(contentType));
 }