Ejemplo n.º 1
0
 public static string ToJson(CustomScriptAssemblyData data)
 {
     return(UnityEngine.JsonUtility.ToJson(data, true));
 }
Ejemplo n.º 2
0
        public static CustomScriptAssembly FromCustomScriptAssemblyData(string path, string guid, CustomScriptAssemblyData customScriptAssemblyData)
        {
            if (customScriptAssemblyData == null)
            {
                return(null);
            }

            var pathPrefix = path.Substring(0, path.Length - AssetPath.GetFileName(path).Length);

            var customScriptAssembly = new CustomScriptAssembly();

            customScriptAssembly.Name                  = customScriptAssemblyData.name;
            customScriptAssembly.RootNamespace         = customScriptAssemblyData.rootNamespace;
            customScriptAssembly.GUID                  = guid;
            customScriptAssembly.References            = customScriptAssemblyData.references;
            customScriptAssembly.FilePath              = path;
            customScriptAssembly.PathPrefix            = pathPrefix;
            customScriptAssembly.AutoReferenced        = customScriptAssemblyData.autoReferenced;
            customScriptAssembly.OverrideReferences    = customScriptAssemblyData.overrideReferences;
            customScriptAssembly.NoEngineReferences    = customScriptAssemblyData.noEngineReferences;
            customScriptAssembly.PrecompiledReferences = customScriptAssemblyData.precompiledReferences ?? new string[0];
            customScriptAssembly.DefineConstraints     = customScriptAssemblyData.defineConstraints ?? new string[0];
            customScriptAssembly.VersionDefines        = (customScriptAssemblyData.versionDefines ?? new VersionDefine[0]);

            if (customScriptAssemblyData.includePlatforms != null && customScriptAssemblyData.includePlatforms.Length > 0)
            {
                customScriptAssembly.IncludePlatforms = GetPlatformsFromNames(customScriptAssemblyData.includePlatforms);
            }

            if (customScriptAssemblyData.excludePlatforms != null && customScriptAssemblyData.excludePlatforms.Length > 0)
            {
                customScriptAssembly.ExcludePlatforms = GetPlatformsFromNames(customScriptAssemblyData.excludePlatforms);
            }

            var compilerOptions = new ScriptCompilerOptions();

            compilerOptions.AllowUnsafeCode = customScriptAssemblyData.allowUnsafeCode;

            customScriptAssembly.CompilerOptions = compilerOptions;

            return(customScriptAssembly);
        }
		public static string ToJson(CustomScriptAssemblyData data)
		{
			return JsonUtility.ToJson(data, true);
		}