Пример #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));
        }
Пример #2
0
 public Type GetContentType()
 {
     return(ContentHelper.GetContentType(contentType) ?? customType);
 }
Пример #3
0
 public Type GetValueType(ContentType contentType = ContentType.Unknown)
 {
     return(content != null?content.GetType() : ContentHelper.GetContentType(contentType));
 }